Help us shape the future of Go! Take the 2026 Go Developer Survey

schemair

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package schemair is a serialized form of an SDK service's smithy-go schema graph, so the graph can be rebuilt on first use instead of by the SDK schemas package's init functions.

Index

Constants

This section is empty.

Variables

View Source
var ErrModel = errors.New("schemair: invalid model")

ErrModel marks an invalid or mismatched schema model.

Functions

func Equivalent

func Equivalent(a, b *smithy.Schema) error

Equivalent reports the first difference between the graph rooted at a and the one rooted at b, as every trait view and member the protocols read.

Types

type Member

type Member struct {
	Name   string  `json:"name"`
	Traits []Trait `json:"traits,omitempty"`
	Target int     `json:"to"`
}

Member is a member schema; Traits are those declared on the member itself.

type Model

type Model struct {
	Ops     map[string]Op `json:"ops"`
	Version string        `json:"version"`
	Shapes  []Shape       `json:"shapes"`
	Service int           `json:"service"`
}

Model is one service's schema graph.

func Encode

func Encode(svc *smithy.ServiceSchema, ops map[string]OpRef, pool []*smithy.Schema) (*Model, error)

Encode captures the graph reachable from svc and ops. pool is every shape the SDK package declares; member targets are found in it by shape ID.

func Read

func Read(r io.Reader) (*Model, error)

Read decodes a gzipped JSON model.

func (*Model) Build

func (m *Model) Build() (*Service, error)

Build rebuilds the schema graph.

func (*Model) Check

func (m *Model) Check(svc *smithy.ServiceSchema, ops map[string]OpRef) error

Check rebuilds the model and reports the first difference from the SDK's own graph.

func (*Model) Write

func (m *Model) Write() ([]byte, error)

Write gzips the model as JSON.

type Op

type Op struct {
	Token  string `json:"token,omitempty"`
	Schema int    `json:"op"`
	In     int    `json:"in"`
	Out    int    `json:"out"`
}

Op references an operation's schemas by Shapes index; -1 means none.

type OpRef

type OpRef struct {
	Op, In, Out *smithy.Schema
	Token       string
}

OpRef is an operation's schemas as the SDK package declares them.

type Operation

type Operation struct {
	Schema *smithy.OperationSchema
	Token  string
}

Operation is a decoded operation.

type Service

type Service struct {
	Schema *smithy.ServiceSchema
	Ops    map[string]Operation
}

Service is a decoded service.

type Shape

type Shape struct {
	Prelude   string   `json:"prelude,omitempty"`
	Namespace string   `json:"ns,omitempty"`
	Name      string   `json:"name,omitempty"`
	Type      string   `json:"type,omitempty"`
	Traits    []Trait  `json:"traits,omitempty"`
	Members   []Member `json:"members,omitempty"`
}

Shape is a schema: a prelude shape when Prelude is set, else a declared one.

type Trait

type Trait struct {
	Name  string          `json:"n"`
	Value json.RawMessage `json:"v,omitempty"`
}

Trait is a smithy-go trait by codec name and JSON-encoded fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL