feat: Add support for tuples using prefixItems#30
Open
mskrip wants to merge 1 commit into
Open
Conversation
The specification for prefixItems is from JSONSchema (https://json-schema.org/understanding-json-schema/reference/array#tupleValidation)
phalt
pushed a commit
that referenced
this pull request
Jun 11, 2026
- New model_utils.lenient_validator: malformed optional scalar values in real-world specs (e.g. YAML float for 'pattern', Swagger-2-style 'required: true' on a property schema) fall back to the field default instead of rejecting the whole document. Applied to Schema, Parameter, Header, Response, RequestBody, Operation, and PathItem. Raw values stay available via model_extra (where mirrored) and OpenAPISpec.raw. This fixes a strictness regression versus 0.3.0, where these keywords lived unvalidated in model_extra. - Schema.prefix_items: typed prefixItems (JSON Schema tuple validation, OpenAPI 3.1) with recursive parsing, extras mirroring, and __str__ support. Covers the feature proposed in PR #30. - SpecModel collection parsing now skips non-dict items (matching the list kind) instead of crashing on malformed entries. - Simplified PathItem.from_dict: $ref/summary/description resolve via the plain splat and Pydantic aliases. - New tests: tests/spec/test_lenient_parsing.py plus prefixItems cases. https://claude.ai/code/session_012uMV8n26pbFxhKLu83rTjE
phalt
pushed a commit
that referenced
this pull request
Jun 11, 2026
- New model_utils.lenient_validator: malformed optional scalar values in real-world specs (e.g. YAML float for 'pattern', Swagger-2-style 'required: true' on a property schema) fall back to the field default instead of rejecting the whole document. Applied to Schema, Parameter, Header, Response, RequestBody, Operation, and PathItem. Raw values stay available via model_extra (where mirrored) and OpenAPISpec.raw. This fixes a strictness regression versus 0.3.0, where these keywords lived unvalidated in model_extra. - Schema.prefix_items: typed prefixItems (JSON Schema tuple validation, OpenAPI 3.1) with recursive parsing, extras mirroring, and __str__ support. Covers the feature proposed in PR #30. - SpecModel collection parsing now skips non-dict items (matching the list kind) instead of crashing on malformed entries. - Simplified PathItem.from_dict: $ref/summary/description resolve via the plain splat and Pydantic aliases. - New tests: tests/spec/test_lenient_parsing.py plus prefixItems cases. https://claude.ai/code/session_012uMV8n26pbFxhKLu83rTjE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The specification for prefixItems is from JSONSchema (https://json-schema.org/understanding-json-schema/reference/array#tupleValidation)