Crate oa_gateway_uci

Source
Expand description

Schema-aware UCI XML โ†” OMS JSON.

The engine stays on opaque bytes. Adapters call Message::from_json / Message::from_xml and emit the other serialization. Conversion is deliberately forgiving; Message::violations is what names a payload that converted and still does not follow the schema.

A Schema tells the converter what it cannot infer from a single document: whether a field repeats, and whether a leaf is a number, a boolean, or a string. Compile one from the published XSD with xsd::compile. The slice module holds a small hand-written schema for tests only.

Re-exportsยง

Modulesยง

  • error ๐Ÿ”’
  • instance ๐Ÿ”’
    Schema-annotated instance tree. Adapters convert; the engine never sees this.
  • json ๐Ÿ”’
    OMS JSON โ†’ instance tree โ†’ OMS JSON.
  • What each xs: primitive accepts.
  • schema ๐Ÿ”’
    In-memory model of a UCI schema. Enough for the OMS JSON rules; not a full XSD processor.
  • Test fixture: a hand-authored sliver of UCI 2.5, not the message catalog.
  • Checking a converted message against the schema it claims to follow.
  • xml ๐Ÿ”’
    UCI XML โ†’ instance tree โ†’ UCI XML.
  • Compile the published UCI XSD into a Schema.

Structsยง

  • Child fields of a complex type, in document order.
  • A named complex type: whether it is abstract, and how it is built.
  • The facets in force for a type, gathered along its restriction chain.
  • One element declaration: name, type, and occurrence range.
  • Constraints a simple type places on a value, as written.
  • A run of element declarations under one compositor.
  • One UCI / OMS message: a global element and its body.
  • Enough of a UCI schema to convert and validate OMS JSON.
  • A named simple type: the type it restricts, and the facets it adds.

Enumsยง

  • One child name: a single occurrence or a repeating group.
  • Upper bound of an element declaration. Self::is_array is what conversion uses to decide a JSON array.
  • A leaf or a complex element.
  • A scalar as JSON would carry it. XML text that does not fit the declared primitive stays a Self::String rather than being coerced.
  • Why a payload could not be converted, or a schema could not be compiled.

Constantsยง

  • Deepest element nesting accepted when converting a payload.

Functionsยง

  • One compositor whose members are alternatives.
  • Required once (minOccurs=1, maxOccurs=1).
  • Zero or more (minOccurs=0, maxOccurs unbounded).
  • Optional once (minOccurs=0, maxOccurs=1).
  • Whether bytes look like OMS JSON: UTF-8 whose first non-space is {.
  • Whether bytes look like XML: UTF-8 whose first non-space is <.
  • One compositor whose members stand on their own.