Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.17 KB

compatibility.rst

File metadata and controls

30 lines (20 loc) · 1.17 KB

Compatibility

By default, Schemathesis is strict on Open API spec interpretation, but other 3rd-party tools often are more flexible and not always comply with the spec.

FastAPI

FastAPI uses pydantic for JSON Schema generation and it produces Draft 7 compatible schemas. But Open API 2 / 3.0.x use earlier versions of JSON Schema (Draft 4 and Wright Draft 00 respectively) which leads to incompatibilities when Schemathesis parses input schema.

This is a known issue on the FastAPI side and Schemathesis provides a way to handle such schemas. The idea is based on converting Draft 7 keywords syntax to Draft 4.

To use it you need to add this code before you load your schema with Schemathesis:

import schemathesis

# will install all available compatibility fixups.
schemathesis.fixups.install()
# You can also provide a list of fixup names as the first argument
# schemathesis.fixups.install(["fastapi"])

If you use CLI, then you can utilize --fixups=all option.