0.1.12 • Published 3 years ago

soms v0.1.12

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

soms

Simple, Opinionated Message Schema

Types

  • boolean
  • int64
  • double
  • string
  • user-defined type (UDT)
  • Array<boolean | int64 | double | string | UDT>

All types are nullable except Arrays, which may be zero-length.

Constants

  • name : string
    • Description: the name of the constant.
  • type : boolean | int64 | double | string | UDT | Array<boolean | int64 | double | string | UDT>
    • Description: the type of the constant.
  • value: string
    • Description: the serialized form of the value of the constant.

In principle these will be treated as closely as the target language allows to the platonic ideal of static const in the context of whichever containing structures they appear in.

Fields

  • name : string
    • Description: the name of the field.
  • type : "boolean" | "int64" | "double" | "string" | <UDT-name> | "Array<" <boolean | int64 | double | string | UDT> ">"
    • Description: the type of the field.
  • (optional) position : int64
    • Description: the zero-indexed position of the field in its containing structure.
    • Default value: the order in which the field is declared within its containing structure in the AST.
  • (optional) optional : boolean
    • Description: whether the field may be absent in serialized form. Optional fields are implicitly assumed to be present and default-valued. Deserialization must not require optional fields, but serialization must output them. The point of this is to balance ease of hand-writing objects with simplicity of serde implementation.
    • Default value: false
  • (optional) default-value : boolean | int64 | double | string | UDT | Array<boolean | int64 | double | string | UDT>
    • Description: the default value to use for implicitly specified values.
    • Default value: null for boolean | int64 | double | string | UDT, zero-length Array for Array types.

User-Defined Types (UDTs)

  • name : string
    • Description: the name of the UDT (i.e., the class name).
  • (optional) constants : Array<Constant>
    • Description: whatever static const things you want in the UDT.
    • Default value: zero-length Array<Constant>.
  • (optional) fields : Array<Field>
    • Description: whatever fields you want in the UDT.
    • Default value: zero-length Array<Field>.

Packages

  • name : string
    • Description: the name of the package (or module, or namespace, or whatever makes most sense in the target language).
  • (optional) constants : Array<Constant>
    • Description: whatever static const things you want in the package.
    • Default value: zero-length Array<Constant>.
  • (optional) udts : Array<UDT>
    • Description: whatever UDTs you want in the package.
    • Default value: zero-length Array<UDT>
0.1.12

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago