Documentation
¶
Index ¶
- func ApplyLayout(context *codegen.AttributeContext, attribute *expr.AttributeExpr)
- func BuildValuePlan(value *transportir.ValueTarget, target *expr.AttributeExpr, ...) *transportir.ValueTarget
- func CustomCodec(attribute *expr.AttributeExpr) string
- func DocumentTarget(source *service.ValueData, target *expr.AttributeExpr, selected string, ...) *transportir.ValueTarget
- func DocumentationPlanRequest(request expr.ValuePlanRequest) expr.ValuePlanRequest
- func FieldWireNames(attribute *expr.AttributeExpr, name string) (string, string, error)
- func PrepareEndpointExamples(endpoint *transportir.Endpoint, generator *expr.ExampleGenerator) error
- func PrepareService(source *expr.HTTPServiceExpr, semantic *service.Data) (*transportir.Service, error)
- func PrepareServiceExamples(service *transportir.Service, source *expr.HTTPServiceExpr, ...) error
- func PrepareStandaloneExamples(attribute *expr.AttributeExpr, generator *expr.ExampleGenerator) (*transportir.ValueTarget, error)
- func PrepareStreamSchema(endpoint *transportir.Endpoint, target *expr.AttributeExpr, inbound bool) *transportir.ValueTarget
- func PrepareTargetExamples(target *transportir.ValueTarget, attribute *expr.AttributeExpr, ...) error
- func ServiceLayouts(endpoints []*transportir.Endpoint) (Layout, Layout)
- func TargetGraph(target *expr.AttributeExpr) *expr.AttributeExpr
- func ValueTarget(source *service.ValueData, target *expr.AttributeExpr, selection string, ...) *transportir.ValueTarget
- func WalkUserTypes(dt expr.DataType, cb func(expr.UserType), seen ...map[string]struct{})
- type Field
- type FieldEncoding
- type Layout
- func (l Layout) Bind(context *codegen.AttributeContext)
- func (l Layout) Record(userType expr.UserType, presence, pointer, defaults bool)
- func (l Layout) RecordAll(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
- func (l Layout) RecordNested(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
- func (l Layout) RecordRoot(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
- type SSEEncoding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyLayout ¶
func ApplyLayout(context *codegen.AttributeContext, attribute *expr.AttributeExpr)
ApplyLayout applies the already allocated physical declaration layout. The maps belong to the generation context and use generated Go identity, never schema identity or an occurrence's semantic cache key.
func BuildValuePlan ¶
func BuildValuePlan(value *transportir.ValueTarget, target *expr.AttributeExpr, context *codegen.AttributeContext, use expr.ValuePlanUse) *transportir.ValueTarget
BuildValuePlan runs at the actual body declaration owner, after layout and view selection. Its policies consume the same tags used by the emitter.
func CustomCodec ¶
func CustomCodec(attribute *expr.AttributeExpr) string
CustomCodec follows the same replacement sites as goTypeDef. Finalization removes recognized matching framework Nullable metadata; ordinary Optional/Nullable/JSONValue layout chosen by the emitter needs no replacement. Any residual authored replacement keeps its external codec contract.
func DocumentTarget ¶
func DocumentTarget(source *service.ValueData, target *expr.AttributeExpr, selected string, independent, schemaOnly bool) *transportir.ValueTarget
func DocumentationPlanRequest ¶
func DocumentationPlanRequest(request expr.ValuePlanRequest) expr.ValuePlanRequest
DocumentationPlanRequest captures OpenAPI visibility in the value plan before projection. It preserves supplied emitter policies and hides only fields explicitly excluded from the documentation contract. Runtime plans are unchanged.
func FieldWireNames ¶
FieldWireNames returns the actual JSON and form names emitted for a field. A name of "-" excludes that codec; an empty form name is not form-encoded. JSON's empty tag name falls back to the emitted Go field name.
func PrepareEndpointExamples ¶
func PrepareEndpointExamples(endpoint *transportir.Endpoint, generator *expr.ExampleGenerator) error
PrepareEndpointExamples binds every documentation surface after schema plans exist. Callers omit this stage when a custom projector owns raw sampling.
func PrepareService ¶
func PrepareService(source *expr.HTTPServiceExpr, semantic *service.Data) (*transportir.Service, error)
PrepareService captures transport representation ownership before either Go emission or schema registration. An emitter supplies its existing semantic service data. A standalone schema caller supplies nil: only source occurrences are captured, without service generation, example selection or synthesis. Go naming remains a separate operation on the emitter's owned transport graph.
func PrepareServiceExamples ¶
func PrepareServiceExamples(service *transportir.Service, source *expr.HTTPServiceExpr, generator *expr.ExampleGenerator) error
PrepareServiceExamples selects each service-owned representative once. It is an explicit example stage: schema-only preparation never calls it.
func PrepareStandaloneExamples ¶
func PrepareStandaloneExamples( attribute *expr.AttributeExpr, generator *expr.ExampleGenerator, ) (*transportir.ValueTarget, error)
PrepareStandaloneExamples captures one documentation occurrence for a schema analyzed outside a service method. It selects or synthesizes once and builds separate structural and projecting plans over the same owner.
func PrepareStreamSchema ¶
func PrepareStreamSchema(endpoint *transportir.Endpoint, target *expr.AttributeExpr, inbound bool) *transportir.ValueTarget
PrepareStreamSchema pairs a finalized inline or view-projected stream target with the prepared stream's source and codec. It uses the service's existing declaration layout; neither media labels nor schema shape select the codec.
func PrepareTargetExamples ¶
func PrepareTargetExamples( target *transportir.ValueTarget, attribute *expr.AttributeExpr, generator *expr.ExampleGenerator, ) error
PrepareTargetExamples binds one target's selected authored group, or its retained representative, to exact semantic-owner plans. It never reads raw example values or selects a union branch in the documentation consumer.
func ServiceLayouts ¶
func ServiceLayouts(endpoints []*transportir.Endpoint) (Layout, Layout)
ServiceLayouts allocates the same root-before-nested layout precedence used by emitted server and client body declarations.
func TargetGraph ¶
func TargetGraph(target *expr.AttributeExpr) *expr.AttributeExpr
func ValueTarget ¶
func ValueTarget(source *service.ValueData, target *expr.AttributeExpr, selection string, codec expr.ValueCodec, schemaOnly bool) *transportir.ValueTarget
Types ¶
type Field ¶
type Field struct {
// Layout owns pointer and wrapper choices used by the declaration emitter.
Layout encodingmeta.FieldLayout
// Encoding owns emitted tags and their corresponding JSON observation.
Encoding FieldEncoding
}
Field is one physical body field and its resolved encoding contract.
func ResolveField ¶
func ResolveField(parent *expr.MappedAttributeExpr, name string, attribute *expr.AttributeExpr, pointer, useDefault, jsonPresence bool) Field
ResolveField selects the field layout once for declaration and projection. Callers restore registered named layouts before supplying occurrence flags.
type FieldEncoding ¶
type FieldEncoding struct {
// Tags is the rendered Go struct tag.
Tags string
// JSON describes the tag that is actually present in Tags.
JSON encodingmeta.JSONField
}
FieldEncoding pairs all codec tags with the shared resolved JSON contract.
func FieldTags ¶
func FieldTags(att *expr.AttributeExpr, name string, optional bool, policy encodingmeta.JSONFieldPolicy) FieldEncoding
FieldTags resolves all codec tags from the actual JSON field policy. Non-JSON codecs retain their existing empty-value omission contract.
type Layout ¶
type Layout struct {
// JSONPresence selects explicit JSON field presence.
JSONPresence map[string]bool
// Pointer selects pointer storage.
Pointer map[string]bool
// UseDefault selects defaulted value storage.
UseDefault map[string]bool
}
Layout records the physical presence policy allocated to Go declarations. It is generation-local mutable analysis state, not semantic occurrence state.
func (Layout) Bind ¶
func (l Layout) Bind(context *codegen.AttributeContext)
Bind exposes this registry through the shared attribute context.
func (Layout) RecordAll ¶
func (l Layout) RecordAll(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
RecordAll records every declaration reachable from an attribute.
func (Layout) RecordNested ¶
func (l Layout) RecordNested(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
RecordNested records descendants without replacing the separately allocated root.
func (Layout) RecordRoot ¶
func (l Layout) RecordRoot(attribute *expr.AttributeExpr, presence, pointer, defaults bool)
RecordRoot records only a named root declaration.
type SSEEncoding ¶
type SSEEncoding struct {
// Codec identifies the mapped field's physical wire encoding.
Codec expr.ValueCodec
// DereferenceString records the emitter's optional native string handling.
DereferenceString bool
}
SSEEncoding describes the dynamic value passed to EncodeSSEData. Named Go types and pointer/presence wrappers use its JSON fallback, not native dispatch.
func MappedSSEEncoding ¶
func MappedSSEEncoding(typeRef string, pointer bool) SSEEncoding
MappedSSEEncoding classifies an actual emitted Go field type reference and pointer policy. It is shared by SSE payload emission and schema preparation.