-
Notifications
You must be signed in to change notification settings - Fork 374
more information when swagger error vs warning, much easier to debug #43 #44
Conversation
I don't think this is a good idea as-is and let me explain why. There are three parts of the error/warning that should always be short (reasonably at least):
swagger-tools is already printing the information that has real value to them, The purpose of the CLI is to give a pointer/reference to where the problem lies in your document and a human readable error message that explains the problem, much like other CLI tools do. When I designed this, I looked at existing tools like JSHint to see how they printed their output. One thing you might not be aware of is that there is already a way to invoke the CLI to get the full JSON representation of the validation errors. If you pass the With the |
I agree, @whitlockjc. I think there should be a compact representation by default and what exists provides enough of a pointer to figure out where to look. Showing the data would generally be redundant - as you'll see the data as soon as you look at the element anyway to figure out the issue. But if you really need it, as you said, there's the --json flag... |
Makes sense. I was thinking from a beginner's perspective where they may be very unfamiliar and the more verbose the error the better the ability to diagnose the problem which means the better adoption of a relatively new library. That is an example that seems to be tailored to a first time user. But that could also be a personal preference. Thanks for checking this out! |
I get it. I'll have to think of a good way to handle this. I could add a message along the lines of: As for What do you think? |
I think that's a good idea. Allows the new user to see how to quickly get more information on their error with minimal impact to someone who doesn't want that information by default. The only consideration about |
Good to know. I'm going to close this merge request and instead create a new issue for adding the |
It could just be an alias where you could use either --json or --verbose. |
👍 |
Done. |
This is my suggestion for #43 When there is an error in the swagger doc just give us the whole error object. I think that would help people just getting started with your library. Myself included.