JsonSchemaConfig
Configuration for JSON Schema transformers.
Controls schema generation behavior with individual flags for nullable handling and required field handling. Use the Strict preset for full JSON Schema Draft 2020-12 compliance.
Configuration Flags
Required Field Behavior
| respectDefaultPresence | requireNullableFields | Behavior |
|---|---|---|
| true | false | Fields without defaults required; nullable fields with defaults optional |
| true | true | Fields without defaults required; nullable fields always required |
| false | true | All fields required (including nullables) |
| false | false | Only non-nullable fields required |
Nullable Type Representation
| useUnionTypes | useNullableField | Output |
|---|---|---|
| true | false | {"type": ["string", "null"]} (JSON Schema Draft 2020-12) |
| false | true | {"type": "string", "nullable": true} (legacy OpenAPI) |
| false | false | {"type": "string"} (no nullable indication); nullable properties are omitted from required |
Author
Konstantin Pavlov
See also
Inheritors
Constructors
Properties
Whether object schemas allow properties that are not declared.
Whether to include discriminator in polymorphic schemas.
Whether to include a type discriminator field in polymorphic schemas.
Whether nullable fields must be present in JSON.
Whether to derive required fields from each property's optionality and default value.
Whether $defs keys, $ref targets, the root $id and discriminator const values use the shortest unique dotted suffix of the type's qualified name (com.acme.Payload becomes Payload).
Whether to emit the nullable field for nullable types.
Whether to use union types for nullable fields.