Skip to content

feat(openapi3): ServerURLTemplateError cluster for server URL template failures#1174

Closed
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-server-url-template
Closed

feat(openapi3): ServerURLTemplateError cluster for server URL template failures#1174
reuvenharrison wants to merge 1 commit into
getkin:masterfrom
oasdiff:feat/validation-error-server-url-template

Conversation

@reuvenharrison

Copy link
Copy Markdown
Contributor

Adds a ServerURLTemplateError cluster covering the three server URL template failure sites in Server.Validate.

Site Leaf Trigger
server.go:208 *ServerURLMismatchedBraces { and } count differ
server.go:212 *ServerURLUndeclaredVariables template-variable count ≠ Server.Variables count
server.go:218 *ServerURLUndeclaredVariables declared variable name not in URL template

The two undeclared-variables sites share a leaf because they share their Error() string and represent the same defect from a consumer's perspective.

The cluster carries URL string so callers don't have to parse the message to recover the offending template.

Backward compat

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

Tests

TestValidationError_ServerURLTemplateLeaves covers all three sites end-to-end.

…e failures

Converts three server URL template sites:
- mismatched { and }
- undeclared variables (template/Variables count mismatch)
- undeclared variables (declared name not in URL template)
@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