fix: Inlining of references with dot (#2109) - #2384
Merged
Merged
Conversation
djankows
approved these changes
Aug 24, 2026
ewaostrowska
force-pushed
the
issue-2109
branch
from
August 25, 2026 08:12
cb0afbe to
8a50dd6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
InlineModelResolver.flatten()generated bare schema names (e.g.admin.user) instead of fully-qualified local references (#/components/schemas/admin.user) in every$refit produced. For simple names this was harmless, but when a model title contained a dot the bare nameadmin.userwas parsed as a relative file reference rather than a local component reference, breaking resolution.The array-item case for request/response bodies was previously fixed in #2330. This PR applies the same prefix to all remaining paths.
Fix
Every call-site in
InlineModelResolverthat sets a$refto an extracted schema now prependsComponents.COMPONENTS_SCHEMAS_REF(#/components/schemas/) instead of a bare name.Swagger Core's
$refsetter skips the auto-prefix when the name contains a., treating it as a potential relative file path. That's correct for resolve, whereadmin.usercould legitimately refer to./admin.user. In flatten, every schema being referenced has just been extracted into#/components/schemas/by the resolver, so the target is always local.Out of scope (known issues, not introduced by this PR)
Reporter of Getting invalid reference when used with
flatten = trueoption #2109 uses example with a spaceadmin.user schema. The spec requires component keys to match^[a-zA-Z0-9\.\-_]+$.A space is not in that character class, so admin.user schema is not a valid component key.InlineModelResolver.java:179-180registersam(the array) instead ofinner(the item schema). - such behavior is a non-reported bugFixes: #2109
Type of Change
Checklist
Screenshots / Additional Context