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 78f915e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(schema): swagger:model + override publishes a definition + $ref (F1/F2/F4, parts A+B)
Quirk F1/F2/F4 (doc-site-quirks.md). A named type carrying both swagger:model
and a per-type override (swagger:strfmt / swagger:type / swagger:enum) used to
inline the override on referencing fields while emitting a degenerate ORPHAN
definition (strfmt: format dropped; enum: value-less; type: bare underlying),
and never a $ref. Per the agreed unified rule, swagger:model is the opt-in to a
first-class definition: WITH it the type publishes a definition carrying the
FULL override schema and referencing fields $ref it; WITHOUT it an override
type inlines as before.
Two coordinated halves:
* Part B (definition carries the override): buildFromDecl's named case runs
the override classifiers (classifierNamedStructStrfmt / classifierNamedBasic)
on the DEFINITION target, so the def gets {type:string,format:uuid} (F1) /
the enum values (F4) instead of the bare-underlying orphan. swagger:type on
the decl was already applied (F3's decl-site classifierNamedTypeOverride).
* Part A (field site $ref): buildNamedType skips the inline override
classifiers when the named type is swagger:model (decl.HasModelAnnotation())
and falls to the resolveRefOr $ref pivot. The override classifiers — and
their diagnostics, e.g. the F8 swagger:alias deprecation — therefore run
once, at definition build, not per reference.
Corpus effect (the unified decision applied everywhere): existing swagger:model
+ override types flip inline -> $ref, several matching the fixtures' own stated
intent — raw-message-override ("expect {$ref: AsArray/AsObject}"),
swagger-type-array (StructWithBadType "falls through to makeRef"),
named-struct-tags-ref (PhoneNumber "should bubble up as a $ref"), and the
classification mods-strfmt date-time types. A bare $ref field drops inline
field description / x-go-name (standard OAS2 — siblings need an allOf wrap;
identical to every other $ref field; DescWithRef opts the description back in).
Goldens regenerated; TestAliasedTypes / RawMessageOverride case-B assertions
updated to $ref; the F1/F2/F4 witness flipped to the fixed expectations.
NOT yet done — F4b: bare swagger:enum (no name) still parse-errors and collects
no consts (witness carries TODO Part C). Lands next.
* contributes go-swagger/go-swagger doc-site quirks F1, F2, F4
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
"description": "Since we have added the explicit model annotation, we expect this definition\nto bubble up and appear as a $ref in the spec.",
31
-
"type": "object",
29
+
"type": "string",
30
+
"format": "phone",
32
31
"title": "PhoneNumber is a named struct annotated as a strfmt. When used as a\nfield type the scanner emits {type: \"string\", format: \"phone\"} via the\nstrfmt branch of buildNamedStruct.",
"description": "Status is an enum type (named swagger:enum) with swagger:model (F4): values\ninline on referencing fields, or a $ref to an enum definition?",
48
38
"type": "string",
39
+
"enum": [
40
+
"active",
41
+
"closed"
42
+
],
43
+
"x-go-enum-desc": "active StatusActive is active.\nclosed StatusClosed is closed.",
"description": "UUID is a string-format type carrying BOTH swagger:strfmt and swagger:model\n(F1): does it publish a {type:string,format:uuid} definition that fields\n$ref, or inline + an orphan definition?",
0 commit comments