Documentation
¶
Overview ¶
Package diagnostics carries fixtures that exercise the schema builder's diagnostic emission path. Each type is annotated with at least one deliberately invalid construct that the grammar parser rejects with a non-fatal diagnostic; the offending value is dropped from the output spec while the diagnostic flows through Builder.Diagnostics() / Options.OnDiagnostic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmbiguousEmbed ¶
type AmbiguousEmbed struct {
}
AmbiguousEmbed embeds two unrelated types that both promote the `shared` JSON property under different Go names. The schema builder emits a CodeAmbiguousEmbed diagnostic; the resulting spec is last-write-wins (Bar overrides Foo because struct fields iterate in source order — SharedBar is the later embed).
swagger:model AmbiguousEmbed
type BadMaximum ¶
type BadMaximum struct {
// Count holds an arbitrary count.
//
// maximum: notanumber
Count int `json:"count"`
}
BadMaximum has an invalid maximum: value. The parser emits a CodeInvalidNumber diagnostic and the maximum keyword is dropped from the output schema.
swagger:model BadMaximum
type DepthInner ¶
type DepthInner struct {
Foo string `json:"shared"`
}
DepthInner carries `shared` under Go name Foo at the deeper layer.
swagger:model DepthInner
type DepthMiddle ¶
type DepthMiddle struct {
DepthInner
Bar string `json:"shared"`
}
DepthMiddle re-declares `shared` under Go name Bar at its own (shallower) depth, on top of an embed of DepthInner.
swagger:model DepthMiddle
type DepthShadowingEmbed ¶
type DepthShadowingEmbed struct {
DepthMiddle
}
DepthShadowingEmbed exercises legitimate Go-depth-rule shadowing across an embed chain: DepthMiddle.Bar (depth 1 from the parent after embedding) shadows DepthInner.Foo (depth 2). The diagnostic must remain silent.
swagger:model DepthShadowingEmbed
type ExplicitOverride ¶
type ExplicitOverride struct {
Bar string `json:"shared"`
}
ExplicitOverride exercises the explicit-override case: a top-level struct embeds a type carrying `shared`, then re-declares `shared` as its own field. The explicit field wins at embedDepth = 0; the diagnostic must remain silent.
swagger:model ExplicitOverride