Sign in

    moonrockz/smithy-codec/contract does not have a README file

    ContractError

    pub(all) suberror ContractError {
    UnknownProfile(ProfileId)
    UnknownBundle(BundleId)
    InvalidTarget(
    ShapeId
    , String)
    InvalidDeclaration(
    ShapeId
    , String)
    UnsupportedDeclaration(
    ShapeId
    , String)
    ConflictingDeclaration(
    ShapeId
    , String)
    MissingAdapter(
    ShapeId
    , AdapterId)
    PreparationLimit(
    ShapeId
    , String)
    } derive(
    Debug
    )

    A preparation refusal. Each case names the shape whose declaration is refused.

    ContractError::code

    fn ContractError::code(self : ContractError) -> String

    The code of a refusal, used in structured diagnostics.

    ContractError::message

    fn ContractError::message(self : ContractError) -> String

    IdentityError

    pub(all) suberror IdentityError {
    InvalidIdentity(String, String)
    } derive(
    Debug
    )

    A refused boundary value: the constructor name and the reason.

    AdapterId

    pub struct AdapterId {
    // private fields
    } derive(Compare, Eq, Hash,
    Debug
    )

    The identifier of a host-registered scalar adapter, such as morphir.v4.name.
    impl Show for AdapterId

    AdapterId::parse

    fn AdapterId::parse(text : String) -> AdapterId raise IdentityError

    AdapterId::to_string

    fn AdapterId::to_string(self : AdapterId) -> String

    AdapterSignature

    pub struct AdapterSignature {
    id : AdapterId
    inputs : Array[JsonKind]
    output : JsonKind
    orders_keys : Bool
    } derive(Eq,
    Debug
    )

    What a host adapter declares: the JSON kinds that it reads, the logical scalar kind that it produces and whether it orders dictionary keys.

    AdapterSignature::new

    fn AdapterSignature::new(id : AdapterId, inputs~ : Array[JsonKind], output~ : JsonKind, orders_keys? : Bool) -> AdapterSignature raise IdentityError

    BundleDeclaration

    pub struct BundleDeclaration {
    id : BundleId
    declared_on :
    ShapeId

    version_field : WireName
    version_adapter : AdapterId
    releases : Array[ReleaseBinding]
    } derive(
    Debug
    )

    A versioned document bundle declared with the jsonBundle trait.

    BundleDeclaration::binding

    fn BundleDeclaration::binding(self : BundleDeclaration, release : Release) -> ReleaseBinding?

    The binding that supports release, if any.

    BundleId

    pub struct BundleId {
    // private fields
    } derive(Compare, Eq, Hash,
    Debug
    )

    The identifier of a versioned document bundle, such as morphir.
    impl Show for BundleId

    BundleId::parse

    fn BundleId::parse(text : String) -> BundleId raise IdentityError

    BundleId::to_string

    fn BundleId::to_string(self : BundleId) -> String

    DictionaryLayout

    pub struct DictionaryLayout {
    entries : Bool
    accept_other : Bool
    key_adapter : AdapterId?
    order : KeyOrder
    } derive(
    Debug
    )

    Form

    pub struct Form {
    union_member : Int?
    reader : ReaderGuard
    binding : FormBinding
    writer : WriterGuard?
    } derive(
    Debug
    )

    A compact form. A union form selects member and binds fields of its payload; a structure form binds fields of the structure itself.

    FormBinding

    pub(all) enum FormBinding {
    Whole(Int)
    Positional(fixed~ : Array[Int], rest~ : Int?)
    } derive(
    Debug
    )

    JsonKind

    pub(all) enum JsonKind {
    NullKind
    BooleanKind
    NumberKind
    StringKind
    ArrayKind
    ObjectKind
    } derive(Compare, Eq, Hash,
    Debug
    )

    The kind of one JSON value.
    impl Show for JsonKind

    JsonKind::name

    fn JsonKind::name(self : JsonKind) -> String

    JsonKind::of

    fn JsonKind::of(value : Json) -> JsonKind

    JsonKind::parse

    fn JsonKind::parse(text : String) -> JsonKind?

    KeyOrder

    pub(all) enum KeyOrder {
    LexicalKeys
    AdapterKeys
    PreservedKeys
    } derive(Eq,
    Debug
    )

    MemberContract

    pub struct MemberContract {
    name : String
    member_id :
    ShapeId

    target :
    ShapeId

    required : Bool
    wire : WireName
    aliases : Array[WireName]
    tag : WireName
    adapter : AdapterId?
    empty_as_absent : Bool
    null_when_absent : Bool
    flatten : Bool
    } derive(
    Debug
    )

    One member of a structure, union, list or map, with its effective wire decisions.

    OptionalTail

    pub(all) enum OptionalTail {
    OmitTail
    NullTail
    } derive(Eq,
    Debug
    )

    ProfileDeclaration

    pub struct ProfileDeclaration {
    id : ProfileId
    declared_on :
    ShapeId

    rule_set : ProfileId
    writer : WriterMode
    unknown_members : UnknownMemberPolicy
    requires : Array[String]
    // private fields
    }

    A declared serialization profile.

    ProfileId

    pub struct ProfileId {
    // private fields
    } derive(Compare, Eq, Hash,
    Debug
    )

    The identifier of a declared serialization profile, such as morphir-v4. Lower-case letters and digits, separated by single . or -, at most 64 characters.
    impl Show for ProfileId

    ProfileId::parse

    fn ProfileId::parse(text : String) -> ProfileId raise IdentityError

    ProfileId::to_string

    fn ProfileId::to_string(self : ProfileId) -> String

    ReaderGuard

    pub struct ReaderGuard {
    kind : JsonKind
    adapter : AdapterId?
    field : WireName?
    absent : WireName?
    } derive(
    Debug
    )

    Release

    pub struct Release {
    major : Int
    minor : Int
    patch : Int
    } derive(Compare, Eq, Hash,
    Debug
    )

    An exact release major.minor.patch. Comparison is numeric, component by component.
    impl Show for Release

    Release::major

    fn Release::major(self : Release) -> Int

    Release::minor

    fn Release::minor(self : Release) -> Int

    Release::new

    fn Release::new(major : Int, minor : Int, patch : Int) -> Release raise IdentityError

    Release::parse

    fn Release::parse(text : String) -> Release raise IdentityError

    Parse a strict X.Y.Z release: three decimal components without signs or leading zeros.

    Release::patch

    fn Release::patch(self : Release) -> Int

    Release::to_string

    fn Release::to_string(self : Release) -> String

    ReleaseBinding

    pub struct ReleaseBinding {
    interval : ReleaseInterval
    root :
    ShapeId

    profiles : Array[ProfileId]
    } derive(
    Debug
    )

    One supported release interval of a bundle, with its semantic root and allowed profiles. The first profile is the default.

    ReleaseInterval

    pub struct ReleaseInterval {
    since : Release
    until : Release
    } derive(Eq,
    Debug
    )

    A half-open release interval [since, until).

    ReleaseInterval::contains

    fn ReleaseInterval::contains(self : ReleaseInterval, release : Release) -> Bool

    ReleaseInterval::new

    fn ReleaseInterval::new(since : Release, until : Release) -> ReleaseInterval raise IdentityError

    ReleaseInterval::overlaps

    fn ReleaseInterval::overlaps(self : ReleaseInterval, other : ReleaseInterval) -> Bool

    ReleaseInterval::since

    ReleaseInterval::until

    ShapeContract

    pub struct ShapeContract {
    id :
    ShapeId

    kind : ShapeKind
    members : Array[MemberContract]
    layout : ShapeLayout
    accepts : Array[UnionLayout]
    sparse : Bool
    forms : Array[Form]
    } derive(
    Debug
    )

    ShapeContract::member_index

    fn ShapeContract::member_index(self : ShapeContract, name : String) -> Int?

    ShapeKind

    pub(all) enum ShapeKind {
    StructureKind
    UnionKind
    ListKind
    MapKind
    SimpleKind(
    SimpleType
    )
    EnumKind
    IntEnumKind
    } derive(Eq,
    Debug
    )

    ShapeLayout

    pub(all) enum ShapeLayout {
    ObjectStructure
    TupleStructure(TupleLayout)
    UnionShape(UnionLayout)
    ListShape
    Dictionary(DictionaryLayout)
    Scalar(AdapterId?)
    } derive(
    Debug
    )

    TupleLayout

    pub struct TupleLayout {
    fixed : Array[Int]
    rest : Int?
    optional : OptionalTail?
    } derive(
    Debug
    )

    Fixed member positions and an optional final rest list, as member indexes.

    UnionLayout

    pub(all) enum UnionLayout {
    External
    Internal(tag~ : WireName)
    Adjacent(tag~ : WireName, content~ : WireName)
    TagArray(tag_only_unit~ : Bool)
    Untagged(Array[(JsonKind, Int)])
    } derive(
    Debug
    )

    UnknownMemberPolicy

    pub(all) enum UnknownMemberPolicy {
    RejectUnknown
    IgnoreUnknown
    } derive(Eq,
    Debug
    )

    WireContract

    pub struct WireContract {
    root :
    ShapeId

    profile : ProfileId?
    writer : WriterMode
    unknown_members : UnknownMemberPolicy
    fingerprint : String
    shapes : Map[
    ShapeId
    , ShapeContract]
    } derive(
    Debug
    )

    The detached wire contract of one root under one profile. It holds no reference to the source model.

    WireContract::prepare

    fn WireContract::prepare(model :
    Model
    , root :
    ShapeId
    , profile? : ProfileId?, adapters? : Array[AdapterSignature], max_shapes? : Int) -> WireContract raise ContractError

    Prepare the detached wire contract of root under profile, or under the base rules when no profile is selected. adapters declares the scalar adapters that the host has registered.

    WireContract::shape

    WireName

    pub struct WireName {
    // private fields
    } derive(Compare, Eq, Hash,
    Debug
    )

    A JSON object member name or union tag on the wire. It is not empty and has no unpaired surrogate.
    impl Show for WireName

    WireName::parse

    fn WireName::parse(text : String) -> WireName raise IdentityError

    WireName::to_string

    fn WireName::to_string(self : WireName) -> String

    WriterGuard

    pub struct WriterGuard {
    empty : Array[Int]
    present : Array[Int]
    } derive(
    Debug
    )

    A writer uses the form when every empty member is absent or empty and every present member is present and not empty.

    WriterMode

    pub(all) enum WriterMode {
    Canonical
    Expanded
    } derive(Eq,
    Debug
    )

    capabilities

    let capabilities : Array[String]

    The capabilities that this contract preparation implements.

    declared_bundles

    Every bundle declared in the model, by identifier.

    declared_profiles

    Every profile declared in the model, by identifier. Two declarations of one identifier are a conflict.

    loader

    A loader that knows the smithy.serialization traits. The definitions are a built-in source, so an exported model omits them, as it omits the prelude.

    trait_definitions

    fn trait_definitions() -> String

    The IDL source of the smithy.serialization traits. It can also be supplied to an existing Loader with add_builtin_idl. Rule names are open strings, so a runtime refuses a rule that it does not implement instead of the model failing to load.

    trait_source

    let trait_source : String

    The source name of the built-in serialization trait definitions.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io