Skip to content

Fix container diagnostics for external JSON Pointer references - #1326

Merged
stevehu merged 1 commit into
masterfrom
fix/1325-ref-container-keywords-master
Oct 13, 2026
Merged

stevehu merged 1 commit into
masterfrom
fix/1325-ref-container-keywords-master

Conversation

@stevehu

@stevehu stevehu commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #1325

An external $ref to doc.yaml#/components/schemas/Item loads the document without its fragment before selecting the target, so the #1205 fix did not suppress unknown OpenAPI root fields on this path. Mark that load as a container and give it a separate registry cache. Direct registry loads retain their own diagnostics and strict-factory rejection regardless of registry load order; target-schema and subschema keywords still reach the configured factory.

Move the container annotation fallback into Dialect.newValidator, after the error-message, nullable, and discriminator special cases. Make the container marker volatile. The new public SchemaContext.isDocumentContainer(Schema) query allows the dialect package to inspect it.

Known limitation: references within one schema still share loaded documents. If a JSON Pointer reference loads a document before a whole-document reference to it, the latter reuses the container and suppresses root diagnostics, including strict-factory rejection. Reversing that order retains normal root diagnostics. This limitation is documented; reference traversal is unchanged.

Validation:

  • Full suite on JDK 25.0.3: 8,870 tests, 0 failures, 0 errors, 30 skipped.
  • All 19 new recording-factory regression cases pass, covering external references, both OpenAPI dialects, preload/cache settings, strict factories, registry load ordering, anchors/whole-document references, $id and nested dialects, and special-keyword ordering.
  • Independent review reported 18 of the 19 new cases failing against the original implementation on both branches.
  • git diff --check passes. Final publication edits only clarify the documented limitation.

@stevehu
stevehu merged commit 0a6755d into master Oct 13, 2026
4 checks passed
@stevehu
stevehu deleted the fix/1325-ref-container-keywords-master branch October 23, 2026 06:54
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.

Unknown-keyword warnings for document fields still appear when a $ref points into an OpenAPI fragment

1 participant