Skip to content

Tags

Tags

v0.16.5

Toggle v0.16.5's commit message
Fix example schema validation review findings

v0.16.4

Toggle v0.16.4's commit message
fix: validate all repeated request header values

v0.16.3

Toggle v0.16.3's commit message
fix: match request paths the same way under every reading

Routers read request paths differently: some decode each segment, some
route on the fully decoded path, some on the escaped path, and some
remove empty and dot segments. The validator read a path one way, so
/users/m%65 matched /users/{id} while a router that decodes segments
dispatched it to /users/me.

The router now resolves the path as sent and under each normalized
reading: decoded path characters, decoded slashes, and empty and dot
segments removed. When two readings select different operations, the
request fails with ValidationSubType "ambiguousPath"
(router.ErrAmbiguousPath, which also matches router.ErrPathNotFound).
paths.FindPath does the same when no router is configured.

Server base paths are removed only on a segment boundary, so a base of
/api no longer turns /apistatus into /status.

The radix tree keeps empty segments, so /items//5 matches /items/{a}/{b}
as the regex matcher does. When the path as sent matches nothing,
doubled slashes are collapsed and matched again, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

v0.16.2

Toggle v0.16.2's commit message
chore: upgrade validator dependencies

v0.16.1

Toggle v0.16.1's commit message
fix: collapse object query param decode into one type assertion

A nil map read is safe, so a missing key and a non-map value are the
same failure as a nil decoded object. Keep one checked type assertion
and one QueryParameterCannotBeDecoded path.

Document QueryParameterCannotBeDecoded. The valid JSON and form cases,
plus the invalid schema and unsupported content cases, still cover the
changed lines.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

v0.16.0

Toggle v0.16.0's commit message
test: complete Arazzo validation coverage

v0.15.2

Toggle v0.15.2's commit message
fix: handle nested property-name content diagnostics

v0.15.1

Toggle v0.15.1's commit message
chore: bump libopenapi to v0.41.2 and go-yaml to v0.1.1

libopenapi v0.41.2 labels its hash fields, so an inline allOf and oneOf with the same members no longer share a compiled schema. go-yaml v0.1.1 dumps node trees without modifying them.

Fixes #314

v0.15.0

Toggle v0.15.0's commit message
fix: resolve open validation issues (#313 #316 #319 #320 #321 #322 #323)

- router/paths: strip server base paths when the host has a variable, try
  every server whose base path prefixes the request, and read path
  parameters from the path the router matched (fixes a panic with strict
  server matching and a variable in the base path) (#313)
- requests/responses: share one media-range matcher that prefers the most
  specific key and no longer panics on a Content-Type without a slash (#316)
- responses: validate every response header that is present, by the
  readings its schema allows; match a default response without content;
  ignore Content-Type header declarations (#321)
- parameters: accept whole numbers written as 1.0 or 1e3 for integers,
  compare integer enums numerically, schema-validate header and cookie
  numbers, reject NaN/Inf and empty matrix values (both panicked), and
  compile parameter schemas with their document's OpenAPI version
  (#319, #320)
- parameters: ignore a path template's #fragment when the request has
  none, as the router does, instead of reporting the parameter missing
- helpers: enforce OpenAPI int32/int64 formats with WithFormatAssertions (#320)
- schema_validation: never marshal document-owned yaml nodes in place (#322)
- tests: stop relying on json.Marshal rejecting map[interface{}]interface{},
  which Go 1.27 accepts (#323)

Fixes #313, fixes #316, fixes #319, fixes #320, fixes #321, fixes #322,
fixes #323

Co-authored-by: adrienyhuel <14916484+adrienyhuel@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

v0.14.1

Toggle v0.14.1's commit message
chore: upgrade to libopenapi v0.41.1 and github.com/pb33f/go-yaml

Move to libopenapi v0.41.1, and with it from go.yaml.in/yaml/v4 to
github.com/pb33f/go-yaml v0.1.0, pb33f's fork. libopenapi's models carry
the fork's yaml.Node, so the validator has to use the same module. The
package is still named yaml, so the change is the import path. jsonpath
moves to v0.8.4 and testify to v0.1.1, which use the same module.

libopenapi requires Go 1.26, so go.mod does too. CI's build job now
reads the Go version from go.mod (checking out first so the file
exists), and golangci-lint moves to v2.12, which is built with Go 1.26.

Since libopenapi v0.39, a schema built from a component-level $ref
reports the index of the file its content came from, while its root
node stays the authored $ref node in the referring file.
buildSchemaDocumentResources looked for that node in the wrong document
and failed with "schema node was not found in its root document". It
now finds the node in the schema's index or, failing that, in its
parent proxy's index, which libopenapi documents as the file the $ref
was written in. This fixes
TestSingleSchemaCompilePreferred_ResolvedExternalReferenceUsesSingleSchemaCompiler
and TestCompileSchemaForValidation_NestedResourceRenderFailure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>