Skip to content

Commit

Permalink
added schema render to path path param validation
Browse files Browse the repository at this point in the history
was missing
  • Loading branch information
daveshanley committed Apr 29, 2024
1 parent 67d7414 commit b29caff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions parameters/validate_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,19 @@ func formatJsonSchemaValidationError(schema *base.Schema, scErrs *jsonschema.Val
if er.KeywordLocation == "" || strings.HasPrefix(er.Error, "doesn't validate with") {
continue // ignore this error, it's not useful
}
schemaValidationErrors = append(schemaValidationErrors, &errors.SchemaValidationFailure{

fail := &errors.SchemaValidationFailure{
Reason: er.Error,
Location: er.KeywordLocation,
OriginalError: scErrs,
})
}
if schema != nil {
rendered, err := schema.RenderInline()
if err == nil && rendered != nil {
fail.ReferenceSchema = fmt.Sprintf("%s", rendered)
}
}
schemaValidationErrors = append(schemaValidationErrors, fail)
}
schemaType := "undefined"
if len(schema.Type) > 0 {
Expand Down

0 comments on commit b29caff

Please sign in to comment.