-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update error messages #30
Conversation
@danut-t thanks for this change, IMO this is a huge improvement to the main goal of this package, which is informing these inconsistencies. Just left a comment about the minor change of the |
@maticardenas Hmm I don't see the comment, could you link it to me please? |
@danut-t it should be visible now, I had forgotten to “submit the review” and it was only visible to me |
So nice! These error messages are so useful 😻 |
9cbaa08
to
b2dbea0
Compare
Currently, the error messages make the debugging hard, as it is difficult to figure out where are there issues (in the request or the documentation), for which request it is happening and what's the exact problem and the expectation.
This PR aims to fix that (partially) by changing a few things:
The existing reference contained minimal information and it also had a bug where it would continuously attach fields to it, even when it should have pointed to only one field. The new format will contain informations about the request path and type, if it's the request or response, and the drilldowned path to the key with the issues (if it's the case)
The new format will look like this: '
<request_type>
<request_path>
><request/response>
><status_code(for responses)>
>path
>to
>key
'and in practice it could look like this:
GET /api/pets > response > 200 > name > id
Update most of the messages to include, besides the new reference, a copy of the actual body and the schema section, along with (hopefully) clearer language as to what went wrong. The combination of these and the new reference should provide enough information to quickly investigate the issue without have to take the request and the documentation and scan for differences side by side.
Examples of how it would look like:
missing property from the request data
missing property from the response data
Besides all of these, another minor change is to use by default json.dumps on
data
whenever the content isapplication/json
in order to reduce verbosity in testsAdditionally Part 3: added support for OAS 3.1 lists of types e.g.: