Skip to content

Wireform.Core.Schema

Packagewireform-coreModuleWireform.Core.Schema

Cross-format schema representation. The Schema tree is the common ground every IDL parser produces (.proto, .avsc, .thrift, .fbs, etc.) and every codegen consumes.

Synopsis

  • data Schema
  • data Field
  • lookupField :: Text -> Schema -> Maybe Field

data SchemaSource

A schema is a name plus a list of fields, each field having a wire tag, a type, and optional metadata. This is intentionally a small lowest-common-denominator: format-specific extensions are carried in annotations.

Constructors

Schema { name :: !Text, fields :: !(Vector Field), annotations :: !(Map Text Text) }

data FieldSource

A single field in a schema.

Fields

fieldName :: !Text

Identifier as it appears in the IDL.

fieldTag :: !Word32

Wire tag (where applicable).

fieldType :: !PrimType

Resolved primitive type.

fieldOptional :: !Bool

lookupField :: Text -> Schema -> Maybe FieldSource

O(log n) field lookup by name.