Skip to content

Keep string defaults and examples as strings, and keep null const and default - #293

Merged
adamw merged 1 commit into
masterfrom
fix-null-and-string-defaults
Oct 25, 2026
Merged

adamw merged 1 commit into
masterfrom
fix-null-and-string-defaults

Conversation

@adamw

@adamw adamw commented Oct 25, 2026

Copy link
Copy Markdown
Member

Follow-up to #292.

  • String values in string schemas: default and examples values like "1" or "true" were written as a number or boolean. They now follow the same rule as enum and const: written as strings. JSON-encoded strings (e.g. "\"a\"", which tapir passes for values encoded by a JSON codec) are unwrapped, for all four fields. No change is needed in tapir.
  • null const and default: {"const": null} and {"default": null} were dropped when decoding, and a null const or default was dropped when encoding. They are now decoded as "null" (as null in enums already is) and written back as null.

… default

- in string schemas, write default and examples values as strings, as
  for enum and const; JSON-encoded strings (e.g. "\"a\"", as tapir
  passes for JSON codecs) are unwrapped
- decode a null const or default as "null" instead of dropping it, and
  write it back as null
@adamw
adamw merged commit 78a9b12 into master Oct 25, 2026
10 checks passed
@adamw
adamw deleted the fix-null-and-string-defaults branch October 25, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant