Repository navigation
Represent null example values as null, drop null defaults and examples - #294
Merged
Merged
Conversation
- Schema.nullable and the decoder use ExampleSingleValue(null) for null, instead of the "null" string, so JSON null and the string "null" no longer mix - in string schemas, unwrap JSON-encoded nulls too (tapir passes "null" for an Option default) - drop null const, default and examples, as before #293, so that JSON and YAML output are the same
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #293.
Schema.nullableand the decoder now useExampleSingleValue(null)for null, instead of the"null"string. JSONnulland the string"null"no longer mix.Optiondefaults: e.g.jsonBody[Option[String]].default(None)passes"null". Keep string defaults and examples as strings, and keep null const and default #293 wrote it as the string'null'. In string schemas, JSON-encoded nulls are now unwrapped too, so it's dropped as before.const,defaultandexamplesare dropped again when encoding (YAML printing dropped them anyway), so JSON and YAML output are the same. A nullconstordefaultdecodes asNone, as before Keep string defaults and examples as strings, and keep null const and default #293.ExampleSingleValueandExampleMultipleValuenow document what the value they hold means, including when aStringis a string and when it is encoded JSON.