Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# FAQ

## Why JSON Schema?

This design was initially inspired by an issue in the `setuptools` repository, and brings a series of advantages and disadvantages.

Disadvantages include the fact that JSON Schema might be limited at times and incapable of describing more complex checks. Additionally, error messages produced by JSON Schema libraries might not be as pretty as the ones used when bespoke validation is in place.

On the other hand, the fact that JSON Schema is standardised and have a widespread usage among several programming language communities, means that a bigger number of people can easily understand the schemas and modify them if necessary.

Additionally, PEP 518 already includes a JSON Schema representation, which suggests that it can be used at the same time as specification language and validation tool.

## Why `fastjsonschema`?

While there are other (more popular) JSON Schema libraries in the Python community, none of the ones the original author of this package investigated (other than fastjsonschema) fulfilled the following requirements:

- Minimal number of dependencies (ideally 0)

- Easy to “vendorise”, i.e. copy the source code of the package to be used directly without requiring installation.

fastjsonschema has no dependency and can generate validation code directly, which bypass the need for copying most of the files when “embedding”.

## Why draft-07 of JSON Schema and not a more modern version?

The most modern version of JSON Schema supported by fastjsonschema is Draft 07. It is not as bad as it may sound, it even supports if-then-else-style conditions…

## Why the URLs used as `$id` do not point to the schemas themselves?

According to the JSON Schema, the $id keyword is just a unique identifier to differentiate between schemas and is not required to match a real URL. The text on the standard is:

> Note that this URI is an identifier and not necessarily a network locator. In the case of a network-addressable URL, a schema need not be downloadable from its canonical URI.

This information is confirmed in a similar document submitted to the IETF.

## Where do I find information about format X?

Please check validate_pyproject.formats.