You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d8f654c
Browse filesBrowse the repository at this point in the historyBrowse files
feat(schema): resolve cross-package leaf type names in type-name keywords
The type-name keyword sites (swagger:type, swagger:additionalProperties,
swagger:patternProperties) resolved a bare type name only within the
annotating type's own package. A name referring to a model in another
package was silently dropped with an "unknown type" diagnostic — a gap
the name-identity work left open: it gave routes/responses cross-package
leaf resolution but not these schema keywords, and a textual merge could
not surface the inconsistency.
Resolve a bare leaf the same way the reduce stage does: own package first
(a local type wins), then uniquely across the scanned packages' annotated
model set —
- exactly one model with that leaf -> its definition (additionalProperties
/patternProperties emit a $ref via DefKey, so reduce shortens it like
any other; swagger:type inlines as before);
- several -> a validate.ambiguous-type-name diagnostic and the reference
is dropped (never guessed);
- none -> the existing unknown-type diagnostic.
Only the annotated model set (fixed before building) is searched, so the
result is a pure function of the source, not of build order. Witness
fixture keyword-xpkg-leaf covers the unique, ambiguous and swagger:type
cases with a golden lock.
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
contributes to go-swagger#2251
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"description": "AmbiguousBag references a leaf (Thing) declared as a model in TWO packages\n(dup1, dup2). Ambiguous -\u003e diagnostic + the marker is dropped.",
"description": "Holder overrides a field type with swagger:type referencing a cross-package\nmodel by leaf (b.Gadget). swagger:type inlines, so the field becomes the\nGadget structure in place.",
0 commit comments