Skip to main content

DEPRECATED_FIELDS

Constant DEPRECATED_FIELDS 

Source
pub const DEPRECATED_FIELDS: &[(&str, &str)];
Expand description

Schema fields the OpenAPI spec marks deprecated: true, as (RustStructName, specFieldName) pairs. Covers both response-side and request-side schemas.

These fields are removed from the struct entirely unless the deprecated-fields Cargo feature is enabled — each one carries a #[cfg(feature = "deprecated-fields")] marker in crate::models. By default the field does not exist, so:

  • On response structs, referencing it is a compile error and it never appears in serialized output; deserializing a payload that still contains it just ignores the extra key.
  • On request structs, callers cannot set it and skip_serializing_if keeps it off the wire entirely.

The list is kept sorted so is_deprecated_field can use binary_search and snapshot diffs stay readable.

Regenerate from the snapshot with:

python3 scripts/regenerate-deprecated-fields.py

The deprecated_fields_match_spec test in tests/spec_coverage_test.rs fails if this list drifts from the spec, and deprecated_fields_hidden fails if a field here lacks the #[cfg(feature = "deprecated-fields")] marker in models.rs (or vice versa).