Skip to content

Document OpenAPI model fragment scoping and fix anchor reference - #10216

Merged
glen-84 merged 1 commit into
mainfrom
gai/openapi-model-fragment-scoping
Aug 10, 2026
Merged

Document OpenAPI model fragment scoping and fix anchor reference#10216
glen-84 merged 1 commit into
mainfrom
gai/openapi-model-fragment-scoping

Conversation

@glen-84

@glen-84 glen-84 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Document the contract for fragment-only OpenAPI definition documents: the first fragment names the shared model, and any further fragments in the same document are private helpers that no other document can spread by name. Also document that fragment names must be unique across every document contributing to one endpoint, since private helpers are not namespaced.
  • Fix FragmentReferenceFinder.Find(document, fragment) reporting the anchor fragment as an external reference. The anchor was removed from the local lookup before the document was visited, so a sibling fragment spreading it was misread as a cross-document dependency, and the two Find overloads disagreed about the same document.
  • Correct the GraphQL comments in the Shared Fragments examples from -- to #.

Test plan

  • New FragmentReferenceFinderTests covering a document whose sibling fragment spreads the anchor; verified failing before the fix (External contained the anchor) and passing after.
  • Full HotChocolate.Adapters.OpenApi.Tests suite on net9.0, net10.0, and net11.0.
  • prettier@3.8.3 --no-config --check on the changed docs page.

Reported in #10214. Not a full fix for that issue: how multi-fragment documents parse is a design decision still to be made, so this documents and names the current behavior rather than changing it.

@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (1/1)

File Covered Changed Patch %
…/src/Adapters.OpenApi.Core/Parser/FragmentReferenceFinder.cs 1 1 100.0% 🟢

Project coverage: 54.4% (242289/445581 lines)

@glen-84
glen-84 merged commit a5b5dbc into main Aug 10, 2026
149 checks passed
@glen-84
glen-84 deleted the gai/openapi-model-fragment-scoping branch August 10, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant