Open nicksloan opened 8 years ago
@nicksloan agree that the error message can be more helpful.
In this case, what would you suggest to make it clearer?
Using Swagger Editor, I got Not a valid response definition
instance failed to match exactly one schema (matched 0 out of 2)
gave me the impression that somehow there were two schemas in play, which made it obvious when I went looking. In my case, the json listed is compiled from multiple files using swagger-parser (the JavaScript one), so the nested schema properties weren't in the same file.
The big thing is that it doesn't say anything about where. Listing the path to the broken section is a huge help in tracking these things down. If nothing else is done, I think showing that would make it far more obvious. I'm not familiar with the code, but I wonder how easy it would be to add to any log entry/error/warning a path to the location in the input data structure that is currently being processed.
When I build a spec (here: https://gist.github.com/nicksloan/0ec7e74af30ac9540ccf) with a schema nested within a schema (see line #647) I am shown a less than helpful error message:
Using the online validator in debug mode is much more helpful in identifying the actual issue:
The codegen version is 2.1.5 from Homebrew.