How to define a heterogeneous array with a specific number of items using JSONSchema (draft/2019-09)? #2071
Unanswered
busticated asked this question in Q&A
Replies: 0 comments
Sign up for free to join this conversation on . Already have an account? Sign in to comment
-
i'd like to be able to specify an array which can only contain specific types, in exact order, with exact count and have the generated Pydantic models enforce that via validation. for example:
...which is to say, my array / list should only ever have 4 entries. indices 0 and 1 should be strings. index 2 should be a number. index 3 should be a boolean. anything else should be flagged as invalid.
is this possible or does it require the as yet unsupported
prefixItems
feature (issue#1546)Beta Was this translation helpful? Give feedback.
All reactions