feat(http): implement ADR-051 YAML input for from_openapi — from_yaml + JSON-first from_str

Adds OpenAPISpec::from_yaml and OpenAPISpec::from_str alongside the
existing from_json. from_str is JSON-first, YAML-fallback (ADR-051 §2):
a valid JSON doc parses through serde_json (stricter grammar, immune to
YAML-specific coercion); only on JSON failure does it fall back to the
YAML parser. yaml_serde 0.10 (resolves to 0.10.4, latest stable) is the
maintained official-YAML-org fork of the deprecated serde_yaml; not
feature-gated per ADR-051 §3 (YAML OpenAPI is first-class).

Note: ADR-051 §2's stated YAML 1.1 boolean-coercion rationale does not
hold for yaml_serde 0.10 (YAML 1.2 core schema — yes/no/on/off are
strings). The JSON-first rule is retained per the Accepted ADR as a
defensive default; tests document the actual 0.10.x behavior with
explicit comments. The ADR rationale should be amended separately.

256 tests pass; clippy + fmt clean.
This commit is contained in:
glm-5.2 committed 2026-07-06 13:15:53 +00:00
1 parent 193f3a0e24
commit 21c4f7d252
4 files changed
+288 -1

No files matched your search

+1
View File
@@ -29,6 +29,7 @@ reqwest-retry = "0.9"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
yaml_serde = "0.10"
async-trait = "0.1"
tracing = "0.1"
thiserror = "2"