Skip to content

Fix #64: use examples array and enum values in auto-generated schema …#73

Merged
RobertoPrevato merged 1 commit intomainfrom
fix/64
Mar 7, 2026
Merged

Fix #64: use examples array and enum values in auto-generated schema …#73
RobertoPrevato merged 1 commit intomainfrom
fix/64

Conversation

@RobertoPrevato
Copy link
Member

…examples

  • get_example_from_schema now checks for the JSON Schema draft 6+ 'examples' array (plural) and uses its first element as a fallback after 'example' (singular) but before dispatching to the type handler.

  • Moved enum handling from StringExampleHandler up to ScalarExampleHandler so that integer, number, and boolean properties with an 'enum' field also render the first enum value instead of falling through to the type default (0, 10.12, True).

  • 'example' (singular) still takes precedence over 'examples' (plural) which takes precedence over enum which takes precedence over type/format defaults.

…examples

- get_example_from_schema now checks for the JSON Schema draft 6+ 'examples'
  array (plural) and uses its first element as a fallback after 'example'
  (singular) but before dispatching to the type handler.

- Moved enum handling from StringExampleHandler up to ScalarExampleHandler so
  that integer, number, and boolean properties with an 'enum' field also render
  the first enum value instead of falling through to the type default (0,
  10.12, True).

- 'example' (singular) still takes precedence over 'examples' (plural) which
  takes precedence over enum which takes precedence over type/format defaults.

Co-authored-by: Copilot <[email protected]>
@RobertoPrevato RobertoPrevato merged commit bbbaeba into main Mar 7, 2026
6 checks passed
@RobertoPrevato RobertoPrevato deleted the fix/64 branch March 7, 2026 07:25
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