Skip to main content
The deprecated keyword indicates that applications should refrain from using the declared property or schema. It signals that a feature may be removed in future versions.

Syntax

The value of deprecated must be a boolean.

Purpose

The deprecated keyword is a metadata annotation that:
  • Marks properties or schemas as deprecated
  • Signals that a feature may be removed in future versions
  • Helps developers migrate away from outdated fields
  • Can be used by tools to warn about deprecated usage
  • Has no effect on validation (it is purely informational)
When multiple occurrences of this keyword are applicable to a single sub-instance, applications should consider the instance location to be deprecated if any occurrence specifies a true value.

Behavior

Property Deprecation

The deprecated keyword applies to each instance location to which the schema object containing the keyword successfully applies. This can result in scenarios where every array item or object property is deprecated even though the containing array or object is not.

Root Schema Deprecation

A root schema containing deprecated with a value of true indicates that the entire resource being described may be removed in the future.

Default Behavior

Omitting this keyword has the same behavior as a value of false.

Examples

Deprecated Property

The username property is marked as deprecated, signaling that developers should use email instead.

Migration Path Documentation

Clear migration instructions help developers update their code.

API Versioning

API evolution using deprecation to guide users to new field names.

Multiple Deprecated Fields

Multiple deprecated fields during a transition period.

Deprecated Enum Value (Pattern)

While you cannot deprecate individual enum values directly, you can document it in the description.

Deprecated Configuration Option

Configuration options deprecated for security reasons.

Deprecated with Timeline

Deprecation notice with version timeline and migration documentation link.

Entire Schema Deprecated

Marking an entire schema as deprecated when replacing it with a new version.

Array Items Deprecated

Deprecating specific array values through documentation.

Conditional Deprecation Documentation

Documenting conditional or partial deprecation.

Replacement Field Indicated

Clear indication of the replacement field improves developer experience.

Best Practices

Provide Clear Migration Instructions

Always explain what developers should use instead:

Include Version Information

Specify when the field was deprecated and when it will be removed:
Provide links to migration guides:

Keep Deprecated Fields Functional

Deprecated fields should continue to work during the deprecation period: