1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! OpenAPI Arazzo Specification — parser and validator.
//!
//! Implements the [Arazzo Specification](https://spec.openapis.org/arazzo/v1.0.1.html):
//! a document format that describes sequences of API calls (*workflows*)
//! and their dependencies, independent of the underlying OpenAPI
//! descriptions they orchestrate.
//!
//! ## Modules
//!
//! - [`common`] — version-agnostic helpers: the `x-` extensions serde
//! helper.
//! - [`validation`] — [`Validate`](validation::Validate) trait,
//! [`ValidationOptions`](validation::ValidationOptions) flag set,
//! `Context` / `ValidationError` types.
//! - [`v1_0`] — Arazzo v1.0 document model + `Validate` impls.
//!
//! ## Parsing and validating
//!
//! ```rust
//! use enumset::EnumSet;
//! use roas_arazzo::v1_0::Description;
//! use roas_arazzo::validation::Validate;
//!
//! // Parse an Arazzo description (JSON or YAML).
//! let doc: Description = serde_json::from_str(r#"{
//! "arazzo": "1.0.1",
//! "info": { "title": "Example", "version": "1.0.0" },
//! "sourceDescriptions": [
//! { "name": "petStore", "url": "https://api.example.com/openapi.json", "type": "openapi" }
//! ],
//! "workflows": [
//! {
//! "workflowId": "getPet",
//! "steps": [
//! {
//! "stepId": "findPet",
//! "operationId": "getPetById",
//! "successCriteria": [ { "condition": "$statusCode == 200" } ]
//! }
//! ]
//! }
//! ]
//! }"#).unwrap();
//!
//! doc.validate(EnumSet::empty()).expect("description is well-formed");
//! assert_eq!(doc.workflows[0].workflow_id, "getPet");
//! ```
//!
//! YAML descriptions work the same way — parse with `serde_yaml_ng` (or
//! any other YAML crate) into [`v1_0::Description`].
//!
//! ## Versions
//!
//! v1.0.x ([`v1_0`], default feature) and v1.1.x ([`v1_1`]) are both
//! implemented; enable whichever you need. With both features enabled,
//! an `impl From<v1_0::Description> for v1_1::Description` is available
//! for upconverting an existing v1.0 description.