fix(route): remove x-properties routes during loading

This commit is contained in:
yusing
2025-06-07 22:28:44 +08:00
parent a90d2b90d1
commit cfe0f6bb70
3 changed files with 22 additions and 3 deletions

View File

@@ -33,8 +33,17 @@ func FileProviderImpl(filename string) (ProviderImpl, error) {
return impl, nil
}
func removeXPrefix(m map[string]any) gperr.Error {
for alias := range m {
if strings.HasPrefix(alias, "x-") {
delete(m, alias)
}
}
return nil
}
func validate(data []byte) (routes route.Routes, err gperr.Error) {
err = serialization.UnmarshalValidateYAML(data, &routes)
err = serialization.UnmarshalValidateYAMLIntercept(data, &routes, removeXPrefix)
return
}