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(target *expr.AttributeExpr, request expr.ValuePlanRequest) expr.ValuePlanRequest
- func FieldWireNames(attribute *expr.AttributeExpr, name string) (string, string, error)
- func FormFieldJSONShape(source *expr.AttributeExpr, codec httpencoding.Codec, ...) (*loom.JSONShape, error)
- func FormJSONShape(source *expr.AttributeExpr, contract *expr.HTTPFormEncoding, ...) (*loom.JSONShape, error)
- func MultipartFieldJSONShape(source *expr.AttributeExpr, codec httpencoding.MultipartCodec, ...) (*loom.JSONShape, error)
- func MultipartJSONShape(source *expr.AttributeExpr, contract *expr.HTTPMultipartEncoding, ...) (*loom.JSONShape, 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 PrepareStandaloneValues(attribute *expr.AttributeExpr, generator *expr.ExampleGenerator, examples bool) (*transportir.ValueTarget, error)
- func PrepareStreamSchema(endpoint *transportir.Endpoint, target *expr.AttributeExpr, inbound bool) *transportir.ValueTarget
- func PrepareTargetValues(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(att *expr.AttributeExpr, cb func(expr.UserType), seen ...map[string]struct{})
- type Contributor
- 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
- type WireContext
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(target *expr.AttributeExpr, 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 FormFieldJSONShape ¶
func FormFieldJSONShape(source *expr.AttributeExpr, codec httpencoding.Codec, context *codegen.AttributeContext) (*loom.JSONShape, error)
FormFieldJSONShape captures a logical field alternative under its resolved content or style grammar. JSON item contents retain JSON names; text records use element names. The source and shared declarations are never mutated.
func FormJSONShape ¶
func FormJSONShape(source *expr.AttributeExpr, contract *expr.HTTPFormEncoding, context *codegen.AttributeContext) (*loom.JSONShape, error)
FormJSONShape captures the logical JSON schema of one form body alternative. It consumes the resolved occurrence's field names and codecs, retains JSON names below JSON-valued fields, and never decodes through a typed Go carrier.
func MultipartFieldJSONShape ¶
func MultipartFieldJSONShape(source *expr.AttributeExpr, codec httpencoding.MultipartCodec, context *codegen.AttributeContext) (*loom.JSONShape, error)
MultipartFieldJSONShape captures a field's schema independently of its typed decoder, preserving the captured per-item branch grammar.
func MultipartJSONShape ¶
func MultipartJSONShape(source *expr.AttributeExpr, contract *expr.HTTPMultipartEncoding, context *codegen.AttributeContext) (*loom.JSONShape, error)
MultipartJSONShape captures one multipart object's logical schema. Physical outer names come from the captured part bindings; JSON contents keep JSON tags.
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, owner *service.SemanticData) (*transportir.Service, error)
PrepareService captures transport representation ownership before either Go emission or schema registration. An emitter supplies its existing semantic service data. A schema caller supplies a semantic owner, or nil to capture standalone occurrences without service generation or example selection. 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 PrepareStandaloneValues ¶
func PrepareStandaloneValues( attribute *expr.AttributeExpr, generator *expr.ExampleGenerator, examples bool, ) (*transportir.ValueTarget, error)
PrepareStandaloneValues captures checked annotations for a documentation occurrence outside a service method. When examples is true it also prepares examples through separate 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 PrepareTargetValues ¶
func PrepareTargetValues( target *transportir.ValueTarget, attribute *expr.AttributeExpr, generator *expr.ExampleGenerator, examples bool, ) error
PrepareTargetValues checks defaults and enums at each captured schema node. When examples is true it also binds selected examples to exact semantic-owner plans. Repeated phases reuse checked annotations without rerunning codecs.
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
ValueTarget binds an exact transport target to its service source. Schema targets retain annotation/example authority; runtime targets capture separate example authority only when an authored root example can override the source.
func WalkUserTypes ¶
func WalkUserTypes(att *expr.AttributeExpr, cb func(expr.UserType), seen ...map[string]struct{})
WalkUserTypes visits each generated declaration identity reachable from att once, including recursive types and the types of the typed additional members of objects.
Types ¶
type Contributor ¶
type Contributor struct {
// Attribute is the projected declaration occurrence.
Attribute *expr.AttributeExpr
// Target is the schema target of Attribute, normalized with the
// projected contract.
Target *transportir.ValueTarget
// Key identifies the declaration, its selected members and their
// resolved wire facts. Equal keys denote equal projections.
Key string
}
Contributor is a declaration projected into the wire context of an HTTP body occurrence: its own contract without the members the body excludes, with the body's wire facts for every member the body shares.
func ProjectContributor ¶
func ProjectContributor(wire *WireContext, projection *expr.HTTPBodyProjection, declaration expr.UserType) (*Contributor, error)
ProjectContributor projects declaration into wire: declaration's own contract through projection, normalized with the declaration's own captured contract rebound to the body's entry for every member the body shares. A member the body does not share, such as a sibling's own field, keeps the entry its declaration resolves.
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.ObjectFields, 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.
type WireContext ¶
type WireContext struct {
// contains filtered or unexported fields
}
WireContext is the resolved wire contract of one HTTP body occurrence: its codec, selected layout and resolved field omission, and for form and multipart bodies, the field contracts that the media contract owners captured from the actual body, keyed by full authored field identity.
func CaptureWireContext ¶
func CaptureWireContext(body *expr.AttributeExpr, target *transportir.ValueTarget, node expr.ValuePlanNode) (*WireContext, error)
CaptureWireContext captures the wire context of the HTTP body object body from its prepared target and exact plan position. It retains selected layout and common-field wire policies without copying semantic constraints.
func (*WireContext) ProjectionIdentity ¶
func (w *WireContext) ProjectionIdentity(projection *expr.HTTPBodyProjection) string
ProjectionIdentity identifies the complete occurrence context before its contributor graph is built. It is provisional, not schema equivalence.
Source Files
¶
- body_context.go
- body_contributor.go
- body_value_plans.go
- document_media.go
- documentation_plan.go
- error_binding.go
- example_preparation.go
- example_preparation_endpoint.go
- field.go
- form_schema.go
- layout.go
- media_variants.go
- multipart_schema.go
- parameter_target.go
- prepare.go
- response_codec.go
- sse_encoding.go
- stream_schema.go
- tags.go
- value_carriers.go
- value_plans.go
- value_target_graph.go
- walk.go