swagger-cli icon indicating copy to clipboard operation
swagger-cli copied to clipboard

more helpful output?

Open dbendy opened this issue 9 years ago • 2 comments

Is there a way to produce more helpful output from the validate command? When I run it against my swagger configuration, this output . . .

Data does not match any schemas from 'oneOf' at #/parameters/RequestID
  Missing required property: schema at #/parameters/RequestID
  Data does not match any schemas from 'oneOf' at #/parameters/RequestID
    Additional properties not allowed: example at #/
    Additional properties not allowed: example at #/
    Additional properties not allowed: example at #/
    Missing required property: required at #/

. . . is pretty cryptic. Apparently, all of those messages are just to tell me that I have included an invalid field example in the RequestId parameter definition. Is there some way to parse this to convey that more clearly? Thanks!

dbendy avatar Jun 30 '16 15:06 dbendy

That output comes from the JSON Schema validator that I'm using. And, agreed, it's not always very intuitive.

I'm currently working on a new version of Swagger Parser that will support different JSON Schema validators, so you'll be able to use a different validator that maybe gives you better output. Or you can create your own validator that just wraps the existing validator and replaces its error messages with better ones.

JamesMessinger avatar Jun 30 '16 20:06 JamesMessinger

They should use a more informative message, like "magma displacement". :-P

jeffory-orrok avatar Apr 18 '21 16:04 jeffory-orrok