Skip to main content

Module extensions

Module extensions 

Source
Expand description

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

Extensions is a flatten target that accepts only keys with the x- prefix. Any other unknown key triggers a deserialize error, surfacing what the audit found to be the architectural root cause: every spec struct silently swallowed unknown fields into a generic BTreeMap.

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,
}

Note: Schema and SchemaDetails are intentionally left with the loose extra: BTreeMap<...> for now — analysis.rs reads JSON Schema 2020-12 keywords (patternProperties, propertyNames, dependentRequired, if/then/else, etc.) directly from there. They are graduated to typed fields under the J5–J8 beads (Phase 2b).

Structs§

Extensions
Map of x-* specification extensions. Any non-x--prefixed key fails to deserialize.