Skip to content

Decode array and object example values to JSON text, clarify the ExampleValue contract - #295

Merged
adamw merged 5 commits into
masterfrom
example-value-contract
Oct 26, 2026
Merged

adamw merged 5 commits into
masterfrom
example-value-contract

Conversation

@adamw

@adamw adamw commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #292, #293 and #294.

  • Arrays and objects in example, default, enum and const values are now decoded to their JSON text (a String, e.g. {"a":1}), not to io.circe.Json. This is the same as what tapir passes for JSON examples, and apispec-model doesn't depend on circe. The encoder parses the text back, so round trips don't change.
  • The encoder no longer has a special case for io.circe.Json values. It was only added in Represent null example values as null, drop null defaults and examples #294 and isn't released.
  • ExampleSingleValue docs: the value is as it appears in the document. A String can also hold the value's encoded text (e.g. a codec's output), which is written as the JSON it holds.
  • SchemaComparator: the Float/BigDecimal check is now in a function over plain values, which is also used for the elements of ExampleMultipleValue.

@adamw
adamw merged commit 466eac5 into master Oct 26, 2026
10 checks passed
@adamw
adamw deleted the example-value-contract branch October 26, 2026 14:40
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