openehr_its/lib.rs
1// SPDX-FileCopyrightText: Cadasto B.V.
2// SPDX-FileCopyrightText: openEHR Foundation
3// SPDX-License-Identifier: Apache-2.0
4
5//! openEHR **ITS** — Implementation Technology Specifications.
6//!
7//! This crate mirrors the four `specifications-ITS-*` sub-repos (aggregated by
8//! `specifications-ITS`): how openEHR RM instances are serialized and exposed.
9//!
10//! - [`json`] — **ITS-JSON**: canonical JSON. The named entry points
11//! (`to_canonical_json`/`from_canonical_json`/`from_canonical_value`, over the
12//! native [`json_codec`]) + the vendored ITS-JSON schema + the interop
13//! fidelity gate (round-trip a vendored real-world canonical-JSON corpus,
14//! `tests/`).
15//! - [`json_codec`] — **ITS-JSON**, native codec: emitted `ToJson`/`FromJson`
16//! impls over a hand-written writer/reader runtime — the canonical-JSON
17//! (de)serialization for every spec type (there is no serde derive on the spec
18//! types; the codec owns the `_type` / number-typing / omission contract).
19//! - [`wire_validate`] — the wire-boundary RM class-invariant dispatch layer:
20//! reads a canonical-JSON node, deserializes via the codec, and runs the RM
21//! invariant cores of `openehr_rm::v1_2::validate` (the `Validate` impls and every
22//! value-level decision stay in `openehr-rm`/`openehr-base`).
23//! - [`xml`] — **ITS-XML**: canonical XML via `quick-xml`, validated against the
24//! vendored XSDs (`schemas/xml/`).
25//! - [`rest`] — **ITS-REST**: the openEHR REST API contract, generated from the
26//! vendored OpenAPI (`vendor/rest-oas/`): the DTOs and route tables under
27//! `rest`, the per-group server traits under `rest-server`, and the per-group
28//! clients with their runtime `rest::client` under `rest-client`.
29//! - **ITS-BMM** has no module here: the vendored BMM meta-model that drives
30//! code generation lives in `openehr-codegen/vendor/bmm`, and the runtime
31//! BMM object model is `openehr-lang`.
32//!
33//! Serialization here is native codec machinery: the canonical-JSON `ToJson`/
34//! `FromJson` codec and the canonical-XML codec are generated over hand-written
35//! runtimes, so the spec crates carry no serde derive.
36//!
37//! # Features
38//!
39//! The default `full` feature is every surface above. The graph underneath it
40//! is layered so a consumer takes only what it reads: `json` is the canonical
41//! JSON base, `xml` adds the XML codecs and `opt14` the operational-template
42//! reader and its writer, [`opt14_writer`]. A `wasm32-unknown-unknown`
43//! consumer takes `default-features = false, features = ["opt14"]`, which
44//! pulls that whole chain; `schema-validation` (`jsonschema` plus the
45//! compiled-in ITS-JSON RM schema) and the three ITS-REST features stay
46//! outside it. `rest` is the
47//! contract both halves share (DTOs, param structs, route tables, `ApiError`)
48//! over serde and `http`; `rest-server` adds the server traits and `axum`;
49//! `rest-client` adds the generated clients and the client runtime over
50//! `reqwest`.
51//!
52//! The Simplified Formats (FLAT / STRUCTURED / Web Template), the RM-instance
53//! validation passes and the SMART scope grammar are hand-written engines over
54//! this wire layer and live in the `openehr-sdt` crate.
55
56// Doctests are copy-paste templates: they must use `?`, never unwrap
57// (C-QUESTION-MARK, https://rust-lang.github.io/api-guidelines/documentation.html#c-question-mark).
58#![doc(test(attr(deny(warnings))))]
59#![allow(
60 clippy::doc_markdown,
61 reason = "module docs are prose with many proper nouns"
62)]
63#[cfg(feature = "xml")]
64pub mod aom2;
65#[cfg(feature = "xml")]
66pub mod aom2_model;
67#[cfg(feature = "json")]
68pub mod json;
69#[cfg(feature = "json")]
70pub mod json_codec;
71#[cfg(feature = "opt14")]
72pub mod opt14;
73#[cfg(feature = "opt14")]
74pub mod opt14_writer;
75pub mod rest;
76#[cfg(feature = "json")]
77pub mod wire_validate;
78#[cfg(feature = "xml")]
79pub mod xml;
80
81/// The openEHR specification version this crate implements.
82///
83/// The pin is deliberately independent of the crates.io package version,
84/// which is the crate's own `SemVer` line and moves only with this
85/// implementation's code.
86pub const SPEC_VERSION: &str = "1.1.0";