oa_gateway::schema

Function load

Source
pub(crate) fn load(config: &Config) -> Result<Option<Arc<Schema>>, String>
Expand description

Reads and compiles the UCI schema listed in config, if any.

Returns None when no schema is listed, which is fine for routing: adapters forward payloads untouched and use the topic as the type hint. It is not fine for owp.xml_baseline, which exists only to convert, so that combination is refused here rather than failing per message once traffic is flowing.

After a successful compile, types this build cannot check are logged as warnings. A constraint that cannot be read enforces nothing, and nothing downstream can tell that from a value that passed.

ยงErrors

Returns an error if owp.xml_baseline is set with no schema files, a listed file cannot be read, or the documents do not compile.