Skip to content

feat(openapi3): SchemaBothFormsExclusive cluster for union-typed schema fields#1177

Closed
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-schema-both-forms
Closed

feat(openapi3): SchemaBothFormsExclusive cluster for union-typed schema fields#1177
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-schema-both-forms

Conversation

@reuvenharrison

Copy link
Copy Markdown
Contributor

Adds a SchemaBothFormsExclusive cluster covering the three schema fields stored as BoolSchema (a union of Has *bool and Schema *SchemaRef) where both forms are set simultaneously.

Site Leaf Field
schema.go:1732 *SchemaAdditionalPropertiesBothForms additionalProperties
schema.go:1838 *SchemaUnevaluatedItemsBothForms unevaluatedItems
schema.go:1855 *SchemaUnevaluatedPropertiesBothForms unevaluatedProperties

This is a different shape from MutuallyExclusiveFieldsError (which is for two separate fields): here a single union-typed field has both forms populated. The cluster carries Field string so callers know which property fired without parsing the message.

Backward compat

Every converted site preserves its original Error() string byte-for-byte.

Tests

TestValidationError_SchemaBothFormsLeaves covers all three sites end-to-end.

…ma fields set both ways

Three sites in schema.go where a BoolSchema-typed field has both forms set:
- additionalProperties
- unevaluatedItems
- unevaluatedProperties

@fenollp fenollp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there, could you turn all these PRs into a single one? Otherwise there will be a lot of rebasing to be done...

@reuvenharrison

Copy link
Copy Markdown
Contributor Author

Superseded by #1180 — combined per @fenollp's request on #1177 to avoid rebase churn. The original commit on this branch is preserved unchanged in #1180.

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.

2 participants