Regression in v0.14.0
After upgrading from v0.13.10 to v0.14.0, ValidateHttpResponse fails at schema-compile time for any operation whose response schema is an inline schema (in an externally-referenced path file) that contains cross-file $refs — a layout used by multi-file OpenAPI projects (e.g. openapi.yaml + paths/*.yaml + schemas/*.yaml).
The error:
200 response body for '/inline-oneof' failed schema compilation: The response schema for status code '200' failed to compile: schema node was not found in its root document
It comes from buildSchemaDocumentResources → jsonPointerForNode(schemaIndex.GetRootNode(), schema.GoLow().GetRootNode()) in schema_validation/schema_resources.go: the pointer walk can't locate the schema's YAML node in the index root document.
Minimal repro
openapi.yaml:
openapi: 3.1.0
info:
title: repro
version: 1.0.0
paths:
/direct-ref:
$ref: './paths/direct.yaml#/p'
/inline-oneof:
$ref: './paths/inline.yaml#/p'
components:
schemas:
Widget:
type: object
properties:
name:
type: string
paths/direct.yaml:
p:
get:
responses:
'200':
description: ok
content:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Widget'
paths/inline.yaml:
p:
get:
responses:
'200':
description: ok
content:
application/json:
schema:
oneOf:
- $ref: '../openapi.yaml#/components/schemas/Widget'
- type: object
properties:
other:
type: string
Validation code:
doc, _ := libopenapi.NewDocumentWithConfiguration(raw, &datamodel.DocumentConfiguration{
BasePath: filepath.Dir(specPath),
SpecFilePath: specPath,
AllowFileReferences: true,
})
model, _ := doc.BuildV3Model()
v := validator.NewValidatorFromV3Model(&model.Model)
ok, errs := v.ValidateHttpResponse(req, resp) // req: GET /inline-oneof, body {name:x}
Observed (v0.14.0)
| case |
result |
/direct-ref (response schema is a bare cross-file $ref) |
✅ ok |
/inline-oneof (inline oneOf with cross-file $refs) |
❌ schema node was not found in its root document |
inline allOf with cross-file $refs (same layout) |
❌ same error |
inline type: array / items: {$ref: cross-file} in a path file |
❌ same error |
same compositions moved into components/schemas with file-internal refs |
✅ ok |
On v0.13.10 all of these pass.
Also possibly related: an allOf defined in an external schema file (./schemas/foo.yaml#/Bar) whose members reference another component in the root document (../openapi.yaml#/components/schemas/Baz) hits the same compile error when reached through a path-level reference.
v0.14.0, libopenapi v0.38.7, go 1.25.
Regression in v0.14.0
After upgrading from v0.13.10 to v0.14.0,
ValidateHttpResponsefails at schema-compile time for any operation whose response schema is an inline schema (in an externally-referenced path file) that contains cross-file$refs — a layout used by multi-file OpenAPI projects (e.g.openapi.yaml+paths/*.yaml+schemas/*.yaml).The error:
It comes from
buildSchemaDocumentResources→jsonPointerForNode(schemaIndex.GetRootNode(), schema.GoLow().GetRootNode())inschema_validation/schema_resources.go: the pointer walk can't locate the schema's YAML node in the index root document.Minimal repro
openapi.yaml:paths/direct.yaml:paths/inline.yaml:Validation code:
Observed (v0.14.0)
/direct-ref(response schema is a bare cross-file$ref)/inline-oneof(inlineoneOfwith cross-file$refs)allOfwith cross-file$refs (same layout)type: array/items: {$ref: cross-file}in a path filecomponents/schemaswith file-internal refsOn v0.13.10 all of these pass.
Also possibly related: an
allOfdefined in an external schema file (./schemas/foo.yaml#/Bar) whose members reference another component in the root document (../openapi.yaml#/components/schemas/Baz) hits the same compile error when reached through a path-level reference.v0.14.0, libopenapi v0.38.7, go 1.25.