Browse Source
According to the JSON Schema specification [1], the "type" keyword may be an array of strings (with unique items). Previously, the Schema definition did not allow this and would thus prevent users from using custom JSON Schema definitions in their field such as `Annotated[..., WithJsonSchema({"type": ["string", "null"]})` as an alternative to the `anyOf` which is usually generated (a ValidationError was raised when generated the OpenAPI definition). We now accept this "type" variant, as illustrated in modified test_custom_schema_fields.py. [1]: https://json-schema.org/draft/2020-12/json-schema-validation#name-typepull/12528/head
2 changed files with 26 additions and 3 deletions
Loading…
Reference in new issue