api-tests: Reduce error output for /register openapi validation.

For descriptive endpoints, such as `/register`, that might raise
Schema Validation errors via `validate_against_openapi_schema`,
omits the OpenAPI schema definition in the error output.

Also omits the error instance definition in the error output
when it is a jsonschema object with over 100 properties. This
means that the test instance for objects, like user settings,
will be printed in the error output, but the test instance for
the entire endpoint will not be printed to the console.

The omitted output can be thousands of lines long making it
difficult to find the initial console output that actually helps
the contributor with debugging.

Adds a section in "Documenting REST API endpoints" about
debugging and understanding these errors that is linked to
in the error console output.
This commit is contained in:
Lauryn Menard
2022-04-21 17:55:05 +02:00
committed by Tim Abbott
parent e80e3b07c4
commit c2bcfb52aa
3 changed files with 200 additions and 0 deletions

View File

@@ -517,6 +517,12 @@ the setting enabled).
Visit Zulip's [Django testing](../testing/testing-with-django.md)
documentation to learn more about the backend testing framework.
Also note that you may already need to update the API documentation for
your new feature to pass new or existing backend tests at this point.
The tutorial for [writing REST API endpoints](../documentation/api.md)
can be a helpful resource, especially the section on [debugging schema
validation errors](../documentation//api.md#debugging-schema-validation-errors).
### Update the frontend
After completing the process of adding a new feature on the backend,