Skip to content

lib_pydantic_generatejsonschema

Custom Pydantic v2 JSON Schema generation tools.

As of Pydantic V2, the JSON Schema representation of model attributes marked as Optional changed, and the new behavior consists in marking the corresponding properties as an anyOf of either a null or the actual type. This is not always the required behavior, see e.g. * https://github.com/pydantic/pydantic/issues/7161 * https://github.com/pydantic/pydantic/issues/8394

Here we list some alternative ways of reverting this change.