Skip to content

feat: Add support for tuples using prefixItems#30

Open
mskrip wants to merge 1 commit into
phalt:mainfrom
mskrip:main
Open

feat: Add support for tuples using prefixItems#30
mskrip wants to merge 1 commit into
phalt:mainfrom
mskrip:main

Conversation

@mskrip

@mskrip mskrip commented Mar 18, 2026

Copy link
Copy Markdown

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
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