Skip to content

feat(openapi3): ExactlyOneFieldError + SingleEntryContentError clusters#1178

Closed
reuvenharrison wants to merge 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-exactly-one-field
Closed

feat(openapi3): ExactlyOneFieldError + SingleEntryContentError clusters#1178
reuvenharrison wants to merge 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-exactly-one-field

Conversation

@reuvenharrison

Copy link
Copy Markdown
Contributor

Two new clusters cover the four parameter/header content+schema sites.

ExactlyOneFieldError

Site Leaf Fields
parameter.go:366 *ParameterContentSchemaExactlyOne content, schema
header.go:75 *HeaderContentSchemaExactlyOne content, schema

Cluster carries Fields []string so callers know which fields the constraint applies to.

SingleEntryContentError

Site Leaf Subject
parameter.go:371 *ParameterContentSingleEntry parameter
header.go:86 *HeaderContentSingleEntry header

Cluster carries Subject string (parameter or header) so callers know whose Content map fired.

Backward compat

Every converted site preserves its original Error() string byte-for-byte, including the historical %v dump of the Header struct in the header content/schema site (preserved verbatim by passing the Header to newHeaderContentSchemaExactlyOne).

Tests

TestValidationError_ParameterHeaderContentSchemaLeaves covers all four sites end-to-end.

…rs for parameter/header content+schema

Four sites:
- parameter.go content/schema must be exactly one
- parameter.go content map must contain at most one entry
- header.go content/schema must be exactly one
- header.go content map must contain at most one entry
@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