Skip to main content

Module extensions

Module extensions 

Source
Expand description

Specification Extensions support — x-* fields per OAS §“Specification Extensions”.

Extensions is a compatibility-oriented flatten target. It retains x-* specification extensions and other leftover keys so imperfect real-world documents continue to parse. Callers can inspect Extensions::non_extension_keys when they want to diagnose fields outside the OAS extension convention.

Use it on every spec struct that previously had #[serde(flatten)] pub extra: BTreeMap<String, Value>:

#[derive(Deserialize)]
struct Foo {
    name: String,
    #[serde(flatten, default)]
    extensions: Extensions,
}

Schema and SchemaDetails also retain a loose extra map. Their common JSON Schema 2020-12 keywords are typed, while the open JSON Schema vocabulary still requires compatibility storage for unknown keywords.

Structs§

Extensions
Map of specification extensions and other compatibility-preserved fields.