📖 2 min read (~ 300 words).

Appendix: shapes & contexts

The two reference tables behind the keyword class pages: the value shapes the lexer assigns to a keyword’s value, and the context tokens used in each page’s scoped summary table.

Value shapes

The grammar’s lexer classifies every value into one of these shapes. The shape determines which Walker callback fires for the property and which field of Property.Typed carries the parsed value.

ShapeTyped payloadExample value forms
numberfloat64 (with optional </<=/>/>=/= prefix)5, 1.5, <10, >=0, =42
integerint645, 100
booleanbooltrue, false, 1, 0
stringraw string^[a-z]+$, date-time, multipart/form-data
comma-listraw string; split on , by Property.AsList()http, https, a,b,c
enum-optiontyped string (closed-vocab match)csv, pipes for collectionFormat:
raw-blockaccumulated body lines on Property.Bodymulti-line YAML, indented token lists
raw-valuethe verbatim post-colon text on Property.Value42, "orange", [1, 2, 3]

When typing fails (e.g. maximum: notanumber) the lexer emits a CodeInvalidNumber / CodeInvalidInteger / CodeInvalidBoolean diagnostic and the property reaches the Walker with a zero-value payload. Consumers gate on Property.IsTyped() to skip malformed-typed values; the corresponding builder field stays unwritten.

Annotation contexts

The closed set of contexts a keyword can legally appear in. Each class page’s scoped summary table combines these in its Contexts column.

ContextMeaning
paramParameter doc on a swagger:parameters struct field, or a + name: chunk inside swagger:route Parameters:
headerHeader field on a swagger:response struct
schemaTop-level model or struct field on a swagger:model
itemsItems-level (array element) validation on either parameter or schema
routeRoute-level metadata under swagger:route
operationInline operation metadata under swagger:operation
metaPackage-level metadata under swagger:meta
responseResponse-level decorations

Using a keyword outside its legal contexts emits a CodeContextInvalid diagnostic and the keyword is dropped from the affected block. The Context matrix maps these tokens onto the annotation families.