Documentation
¶
Overview ¶
Package enum_overrides isolates the v1 behavior of `enum:` when it coexists with (or replaces) `swagger:enum TypeName` const-value inference. The golden output of TestCoverage_EnumOverrides is the factual reference for what the v2 parser migration must preserve — or consciously diverge from — under W2's override semantics (`.claude/plans/workshops/w2-enum.md` §2.6).
Five cases, one per model in this file:
A. swagger:enum + matching consts, no inline enum on field → consts B. inline comma-list on field, no swagger:enum, no consts → inline C. inline JSON array on field, no swagger:enum, no consts → inline D. swagger:enum but NO matching consts in package → ? E. swagger:enum + matching consts + inline enum on field → ?
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotificationA ¶
type NotificationA struct {
// required: true
ID int64 `json:"id"`
// The priority level. Enum values come from PriorityA's consts.
Priority PriorityA `json:"priority"`
}
NotificationA exercises case A: field uses PriorityA, no inline enum override.
swagger:model NotificationA
type NotificationB ¶
type NotificationB struct {
// The priority level.
//
// enum: low, medium, high
Priority string `json:"priority"`
}
NotificationB exercises case B: plain string field with inline comma-list enum. No swagger:enum on the type, no consts in code.
swagger:model NotificationB
type NotificationC ¶
type NotificationC struct {
// The priority level.
//
// enum: ["low","medium","high"]
Priority string `json:"priority"`
}
NotificationC exercises case C: inline JSON-array enum.
swagger:model NotificationC
type NotificationD ¶
type NotificationD struct {
// The priority level.
Priority PriorityD `json:"priority"`
}
NotificationD exercises case D.
swagger:model NotificationD
type NotificationE ¶
type NotificationE struct {
// Inline enum provides a narrower set than the const block.
//
// enum: urgent, normal
Priority PriorityE `json:"priority"`
}
NotificationE exercises case E: the inline enum on the field competes with the const-derived enum from PriorityE. The golden output captures which one wins in v1.
swagger:model NotificationE
type PriorityA ¶
type PriorityA string
PriorityA is a classic linked-const enum.
swagger:enum PriorityA