From e637b3bd53c2c88cea205d79573016d43aa97805 Mon Sep 17 00:00:00 2001 From: Carsten Wickner Date: Mon, 11 Nov 2024 21:50:20 +0100 Subject: [PATCH] chore(docs): update documentation --- CHANGELOG.md | 3 +++ slate-docs/source/includes/_main-generator-options.md | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e2ba4f..3f4bc6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### `jsonschema-generator` +#### Added +- new `Option.NULLABLE_ALWAYS_AS_ANYOF` that avoids the `"null"` type being included with other type values, e.g. `"type": ["object", "null"]` + #### Changed - apply property name overrides before triggering the ignore check (i.e., provide both the declared and overridden property names if there is one) - update various (runtime/test/build-time) dependencies diff --git a/slate-docs/source/includes/_main-generator-options.md b/slate-docs/source/includes/_main-generator-options.md index c99bfbeb..a3e1c952 100644 --- a/slate-docs/source/includes/_main-generator-options.md +++ b/slate-docs/source/includes/_main-generator-options.md @@ -336,11 +336,11 @@ configBuilder.without( 36 Option.ALLOF_CLEANUP_AT_THE_END - #Behavior if includedBehavior if excluded At the very end of the schema generation reduce allOf wrappers where it is possible without overwriting any attributes – this also affects the results from custom definitions. Do not attempt to reduce allOf wrappers but preserve them as they were generated regardless of them being necessary or not. + #Behavior if includedBehavior if excluded 37 Option.STRICT_TYPE_INFO @@ -349,6 +349,14 @@ configBuilder.without( As final step in the schema generation process, ensure all sub schemas containing keywords implying a particular "type" (e.g., "properties" implying an "object") have this "type" declared explicitly – this also affects the results from custom definitions. No additional "type" indication will be added for each sub schema, e.g. on the collected attributes where the "allOf" clean-up could not be applied or was disabled. + + 38 + Option.NULLABLE_ALWAYS_AS_ANYOF + + + A "type": "null" will not be combined with other "type" values in an array. Instead, a separate "anyOf" with a subschema only containing the "type": "null" will be included. + For brevity's sake, a "type": "null" may be combined with other "type" values, e.g. as "type": ["null", "object"]. + @@ -397,3 +405,4 @@ Below, you can find the lists of Options included/excluded in the r | 35 | `PLAIN_DEFINITION_KEYS` | ⬜️ | ⬜️ | ⬜️ | | 36 | `ALLOF_CLEANUP_AT_THE_END` | ✅ | ✅ | ✅ | | 37 | `STRICT_TYPE_INFO` | ⬜️ | ⬜️ | ⬜️ | +| 38 | `NULLABLE_ALWAYS_AS_ANYOF` | ⬜️ | ⬜️ | ⬜️ |