Skip to content

feat(openapi3): EitherFieldRequiredError cluster + SchemaItemsRequired leaf#1175

Closed
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-either-field-required
Closed

feat(openapi3): EitherFieldRequiredError cluster + SchemaItemsRequired leaf#1175
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-either-field-required

Conversation

@reuvenharrison

Copy link
Copy Markdown
Contributor

Adds an EitherFieldRequiredError cluster for "at least one of these fields must be set" failures, plus one new RequiredFieldError leaf for schema.items (required when type=array).

EitherFieldRequiredError (new cluster)

Site Leaf Required fields
example.go:81 *ExampleValueOrExternalValueRequired value, externalValue
link.go:88 *LinkOperationIDOrRefRequired operationId, operationRef

Cluster carries Fields []string so callers don't have to parse the message to learn which fields were eligible.

RequiredFieldError leaf (existing cluster)

Site Leaf Field
schema.go:1688 *SchemaItemsRequired schema.items

Fires only when type=array, no prefixItems, and Draft 2020-12 keywords disabled — i.e. plain OpenAPI 3.0 array schemas missing items.

Backward compat

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

Tests

TestValidationError_EitherFieldRequiredLeaves covers both new-cluster sites; TestValidationError_SchemaItemsRequiredLeaf covers the array-items site.

…red leaf

- example.value or externalValue
- link.operationId or operationRef
- schema.items required when type=array (RequiredFieldError leaf)
@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