Skip to content

feat(openapi3): MutuallyExclusiveFieldsError cluster for forbidden field pairs#1171

Closed
reuvenharrison wants to merge 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-mutually-exclusive
Closed

feat(openapi3): MutuallyExclusiveFieldsError cluster for forbidden field pairs#1171
reuvenharrison wants to merge 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-mutually-exclusive

Conversation

@reuvenharrison

@reuvenharrison reuvenharrison commented May 8, 2026

Copy link
Copy Markdown
Contributor

Adds a MutuallyExclusiveFieldsError cluster covering five sites where the spec forbids two fields being set together.

Site Leaf Field1 / Field2
example.go:78 *ExampleValueExternalValueExclusive value / externalValue
media_type.go:128 *MediaTypeExampleExamplesExclusive example / examples
license.go:79 *LicenseURLIdentifierExclusive url / identifier
link.go:91 *LinkOperationIDRefExclusive operationId / operationRef
schema.go:1415 *SchemaReadOnlyWriteOnlyExclusive readOnly / writeOnly

Backward compat

Every converted site preserves its original Error() string byte-for-byte. The link.OperationID/OperationRef site keeps its dynamic %q formatting via the leaf constructor.

Tests

TestValidationError_MutuallyExclusiveFieldsLeaves covers four of the five sites end-to-end (the fifth, media_type, fires through the same constructor and is exercised indirectly through document round-trips).

…eld pairs

Converts four mutual-exclusion sites:
- example.value vs externalValue
- mediaType.example vs examples
- license.url vs identifier
- link.operationId vs operationRef
@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.

1 participant