AlexStocks commented on code in PR #909:
URL: https://github.com/apache/dubbo-go-pixiu/pull/909#discussion_r3212532649
##########
pkg/filter/http/apiconfig/api_config.go:
##########
@@ -69,17 +74,31 @@ func (factory *FilterFactory) Config() any {
func (factory *FilterFactory) Apply() error {
factory.apiService = api.NewLocalMemoryAPIDiscoveryService()
+ if factory.cfg.Dynamic && (factory.cfg.EnableOpenAPIValidation ||
factory.cfg.OpenAPIPath != "") {
+ return errors.New("dynamic api config does not support openapi
validation")
+ }
+
if factory.cfg.Dynamic {
server.GetApiConfigManager().AddApiConfigListener(factory.cfg.DynamicAdapter,
factory)
return nil
}
+ if factory.cfg.EnableOpenAPIValidation && factory.cfg.OpenAPIPath != ""
{
Review Comment:
[P1] 这里会把 `openapi_path` 编译出来的路由先塞进同一个 `apiService`,后面第 96 行再执行
`InitAPIsFromConfig` 时仍然走 `AddAPI`。只要 `api_config` 和 OpenAPI 里有同一个 path +
method,启动就会因为重复注册直接报错。对 `apiconfig` 这个场景来说,OpenAPI 更像是给现有路由叠加校验元数据,不应该先注册一套只带
`ValidationPlan` 的虚拟路由。建议先加载 `api_config`,再按 path+method 把校验计划 merge 到已有 API
上,或者补一个只更新 metadata 的路径,避免重复 `AddAPI`。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]