Documentation
¶
Overview ¶
Package conformance publishes the vocabulary a conforming client must implement, as data.
A client is conformant when the node types it renders natively are exactly the primitives listed here, and the action kinds it interprets are exactly these kinds. That sentence could not be written as a test before: the primitive tier existed only as TypeScript inside the React client, so "what should this client implement?" had no answer outside that client's own source, and a second client in Swift or Kotlin could not be written from the published contract at all.
The fixture is generated from ui.spec.json and is shipped both ways — embedded here for a Go consumer, and exported from the npm package as `@mosaic-media/sdui/conformance` for a JavaScript one. A client in a language with neither reads the JSON directly; that is the point of it being data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaseFiles ¶ added in v0.28.0
func CaseFiles() []string
CaseFiles lists the corpus files present.
Types ¶
type BindingCases ¶ added in v0.28.0
type BindingCases struct {
Scope map[string]any `json:"scope"`
Cases []struct {
Name string `json:"name"`
Props map[string]any `json:"props"`
Expect map[string]any `json:"expect"`
} `json:"cases"`
}
BindingCases is the binding corpus: one shared scope, many prop bags.
func LoadBindingCases ¶ added in v0.28.0
func LoadBindingCases() (BindingCases, error)
LoadBindingCases decodes the binding corpus.
type Fixture ¶
type Fixture struct {
Comment string `json:"//"`
// Version is the vocabulary version a client declares it implements.
Version string `json:"version"`
// Primitives are the node types a client renders itself.
Primitives []Primitive `json:"primitives"`
// Components are the node types the Platform serves as definitions. A client
// implements none of them — one appearing in a client's registry is the
// drift ADR 0082 was written about.
Components []string `json:"components"`
Actions []string `json:"actions"`
Validators []string `json:"validators"`
Predicates []string `json:"predicates"`
Tones []string `json:"tones"`
Surfaces []string `json:"surfaces"`
}
Fixture is the declared vocabulary. Every field is a set a client is measured against, not a suggestion.
type PredicateCases ¶ added in v0.28.0
type PredicateCases struct {
Values map[string]any `json:"values"`
Cases []struct {
Name string `json:"name"`
Predicate map[string]any `json:"predicate"`
Expect bool `json:"expect"`
} `json:"cases"`
}
PredicateCases is the predicate corpus: one shared set of values, many cases.
func LoadPredicateCases ¶ added in v0.28.0
func LoadPredicateCases() (PredicateCases, error)
LoadPredicateCases decodes the predicate corpus.
type Primitive ¶
type Primitive struct {
Type string `json:"type"`
Tier string `json:"tier"`
Children bool `json:"children"`
Props []string `json:"props"`
}
Primitive is one native node type in the fixture: its name, why-tier, whether its children are rendered, and the prop keys it reads.
type ValidatorCase ¶ added in v0.28.0
type ValidatorCase struct {
Name string `json:"name"`
Rules map[string]any `json:"rules"`
Value any `json:"value"`
Values map[string]any `json:"values"`
Expect string `json:"expect"`
}
ValidatorCase is one golden validator case.
func LoadValidatorCases ¶ added in v0.28.0
func LoadValidatorCases() ([]ValidatorCase, error)
LoadValidatorCases decodes the validator corpus.