Skip to content

feat(openapi3): batch-convert long-tail RequiredFieldError sites#1170

Merged
fenollp merged 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-followup-required-fields
May 9, 2026
Merged

feat(openapi3): batch-convert long-tail RequiredFieldError sites#1170
fenollp merged 2 commits into
getkin:masterfrom
oasdiff:feat/validation-error-followup-required-fields

Conversation

@reuvenharrison

@reuvenharrison reuvenharrison commented May 8, 2026

Copy link
Copy Markdown
Contributor

Seven long-tail untyped errors converted to the *RequiredFieldError cluster pattern.

Site Leaf Field
external_docs.go:66 *ExternalDocsURLRequired externalDocs.url
operation.go:212 *OperationResponsesRequired operation.responses
request_body.go:126 *RequestBodyContentRequired requestBody.content
response.go:182 *ResponseDescriptionRequired response.description
security_scheme.go:389 *OAuthFlowScopesRequired oAuthFlow.scopes
security_scheme.go:405 *OAuthFlowAuthorizationURLRequired oAuthFlow.authorizationUrl
security_scheme.go:418 *OAuthFlowTokenURLRequired oAuthFlow.tokenUrl

Existing tests with require.Equal(t, errors.New("...")) against the converted sites switched to require.EqualError on the message string (one site: operation_test.go's TestOperationValidation).

Two new tests in validation_error_test.go pin the cluster + leaf + base reachability for representative cases (operation.responses, externalDocs.url); the other five follow the same mechanical shape.

Backward compat

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

Scope

Only sites that fit the existing RequiredFieldError cluster — no new cluster types. Other long-tail flavors (mutually-exclusive fields, "should not be set", link XOR-required, etc.) need new clusters and would land in separate follow-ups.

Follow-up to getkin#1166 covering 7 long-tail untyped errors that fit the
existing RequiredFieldError cluster shape:

  - externalDocs.url
  - operation.responses
  - requestBody.content
  - response.description
  - oAuthFlow.scopes
  - oAuthFlow.authorizationUrl
  - oAuthFlow.tokenUrl

Each gets a leaf type, a constructor populating Origin from the
relevant element, and a converted call site. operation_test.go
switches from require.Equal-against-errors.New() to
require.EqualError on the message string. Two representative tests
pin cluster + leaf + base reachability.
@reuvenharrison reuvenharrison force-pushed the feat/validation-error-followup-required-fields branch from d8669b6 to 600079d Compare May 8, 2026 09:00
@fenollp fenollp merged commit d53c8eb into getkin:master May 9, 2026
5 checks passed
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