Open coenvl opened 3 years ago
Errors aren't great, see #74.
However, each of the ValidationError you're seeing comes from the validation backend, not from prance itself. In this case likely the openapi-spec-validator.
What I can tell you offhand is that in the example you posted, the referenced path /components/schemas/animal
does not exist. That cannot really lead to a validation success.
I also do not understand how that second document you posted plays into it. At best, it contains a /definitions/animal
, i.e. a different path. But it seems to also be in a different file, and you're not referencing a different file in your example.
In the end, without further information, I cannot really provide any other pointers. I'm sorry!
Ah, I see I pasted the wrong code in my original post, I editted it to actually use the reference. That's what I get for playing around, moving the definitions into the file.
But as I understand by now, it is because openapi spec is not actually conform JSON schema. In fact they say in their documentation that Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.
, and examples is not a property that is mentioned.
I fixed the issue by stripping all examples from the schema before passing it to prance.
Great to hear you solved it!
Yes, OpenAPI specs are a bit dodgy that way - they say they're JSON Schema, but they're not JSON Schema in a number of places. This is one of them. It doesn't help that they bring YAML thinking to JSON as well and/or mix the two.
Expected Behaviour
Since the JSON schema allows for a (set of) examples to be included in the schema definition, I would expect prance to find the definitions valid.
Minimal Example Spec
api.yaml:
And the corresponding JSON schema
Actual Behaviour
I get a very long and (imho) hard to interpret error:
Steps to Reproduce
I try to validate the api using
prance validate api.yaml
Environment
@jfinkhaeuser