Documentation
¶
Overview ¶
Package output compiles component output encoding independently of transport and delegates wire formats to their native codec owners.
Index ¶
- Variables
- func ContentType(format string) (string, error)
- type CompileInput
- type Compiler
- type JSONWireType
- type Marshaller
- type Plan
- func (p *Plan) DefaultFormat() string
- func (p *Plan) Encode(ctx context.Context, format string, value any) (Result, error)
- func (p *Plan) FormatSelector() (spec.BindSource, bool)
- func (p *Plan) JSONOnly() bool
- func (p *Plan) JSONSchema() (map[string]any, error)
- func (p *Plan) TransportReady() bool
- func (p *Plan) Type() reflect.Type
- func (p *Plan) Wire(format string) (WireContract, error)
- type Result
- type WireContract
Constants ¶
This section is empty.
Variables ¶
ErrSchemaUnavailable means the encoder cannot be described by a static schema. Consumers may omit optional discovery metadata, but must not substitute Go names.
Functions ¶
func ContentType ¶
Types ¶
type CompileInput ¶
type JSONWireType ¶ added in v1.1.0
JSONWireType is an optional declaration for custom JSON marshalers whose successful wire value has a stable, separately typed shape. OpenAPI uses the declared type instead of treating the marshaler as arbitrary JSON.
type Marshaller ¶
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan contains registered output authority, never invocation input or rows.
func (*Plan) DefaultFormat ¶
func (*Plan) FormatSelector ¶ added in v1.1.0
func (p *Plan) FormatSelector() (spec.BindSource, bool)
FormatSelector returns the single declared HTTP source for request-selected output formats. Without one, the legacy _format query source remains active.
func (*Plan) JSONSchema ¶ added in v1.1.0
JSONSchema describes JSON output using the compiled presentation settings. Unlike Wire, this discovery path permits dynamic leaves (including Status.Error). Field naming is kept here, beside the encoder, rather than in MCP input binding.
func (*Plan) TransportReady ¶
TransportReady reports the declared SDK response contract, independently of any invocation result. Documentation may supply static HTTP response schemas.
func (*Plan) Wire ¶
func (p *Plan) Wire(format string) (WireContract, error)
Wire derives representability from the actual compiled encoding plan. Source settings may be changed or absent after compilation and are not authority. Transformed JSON uses the native serializer plan. XML/tabular and opaque encoders still require an explicit wire projection.
type WireContract ¶
type WireContract struct {
JSON *jsonmarshal.WireShape
ContentDisposition string
Type reflect.Type
ContentType string
Binary bool
}
WireContract describes a statically representable encoded result. Type is the wire value type, which may differ from the component's structural output type. Binary marks an opaque byte stream rather than a textual string.