Expand description
Spec-source policy and document parsing shared by the CLI, library consumers, and the WASM playground build.
Everything in this module is pure: URL policy checks build on url::Url
and document parsing goes through serde_yaml/serde_json in memory. The
I/O that actually fetches or reads a spec lives in crate::cli, which is
gated behind the cli feature.
Functionsยง
- is_
remote_ spec - Whether an input string names a supported remote OpenAPI source.
- json_
from_ str_ lossy - Parse JSON with lossy number handling: numbers that overflow i64/u64 are stored as f64.
- parse_
oas_ version - Parse the
openapiversion string into (major, minor). Tolerates patch and build-metadata suffixes. Returns None for unrecognised input. - parse_
spec - sanitize_
source_ provenance - Remove URL credentials, query strings, and fragments before recording a source label in generated code. Local paths are retained as supplied.
- validate_
oas_ document - Validate the
openapiversion field of a parsed document. - validate_
remote_ spec_ url - Parse and enforce the remote-source transport policy.
- yaml_
to_ json_ value - Parse YAML to serde_json::Value, converting large numbers to f64 to avoid overflow. serde_yaml 0.9 cannot represent integers exceeding i64/u64 range (e.g. numbers > 2^64), so we preprocess the YAML to convert such numbers to float notation, then go through serde_yaml::Value and convert to serde_json::Value manually.