Skip to content

Commit

Permalink
fix oas template validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pvormste committed Feb 7, 2025
1 parent 8a4b525 commit 0d1893e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apidef/oas/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
keyDefinitions = "definitions"
keyProperties = "properties"
keyRequired = "required"
keyAnyOf = "anyOf"
oasSchemaVersionNotFoundFmt = "Schema not found for version %q"
)

Expand Down Expand Up @@ -159,6 +160,14 @@ func ValidateOASTemplate(documentBody []byte, oasVersion string) error {
definitions = jsonparser.Delete(definitions, path, keyRequired)
}

unsetAnyOfFieldsPaths := []string{
"X-Tyk-Upstream",
}

for _, path := range unsetAnyOfFieldsPaths {
definitions = jsonparser.Delete(definitions, path, keyAnyOf)
}

oasSchema, err = jsonparser.Set(oasSchema, definitions, keyDefinitions)
if err != nil {
return err
Expand Down

0 comments on commit 0d1893e

Please sign in to comment.