Commit d1fc3b3
Fix enum without explicit type rendering as null (issue #64)
When a schema uses 'enum' without a 'type' field (valid JSON Schema),
get_example_from_schema fell through to 'return None' because there was
no type to dispatch to a ScalarExampleHandler. The enum check in
ScalarExampleHandler.get_example was never reached.
Fix: add an early enum check in get_example_from_schema itself, after
the 'examples' check and before the type dispatch, so typeless enums
also return their first value.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent fda4c0e commit d1fc3b3
2 files changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
| |||
0 commit comments