cyclonedx.schema.deprecation

This module provides warning classes for deprecated features in CycloneDX schemas. Each warning class corresponds to a specific schema version, enabling downstream code to catch, filter, or otherwise handle schema-specific deprecation warnings.

Intended Usage

Downstream consumers can manage warnings using Python’s warnings module. Common scenarios include:

  • Filtering by schema version

  • Suppressing warnings in tests or batch processing

  • Logging or reporting deprecation warnings without raising exceptions

Example

import warnings
from cyclonedx.schema.deprecation import (
    BaseSchemaDeprecationWarning,
    SchemaDeprecationWarning1Dot7,
)

# Suppress all CycloneDX schema deprecation warnings
warnings.filterwarnings("ignore", category=BaseSchemaDeprecationWarning)

# Suppress only warnings specific to schema version 1.7
warnings.filterwarnings("ignore", category=SchemaDeprecationWarning1Dot7)

Notes

  • All deprecation warnings inherit from BaseSchemaDeprecationWarning.

  • The SCHEMA_VERSION class variable indicates the CycloneDX schema version where the feature became deprecated.

  • These warning classes are designed for downstream filtering and logging, not for raising exceptions.

Exceptions

BaseSchemaDeprecationWarning

Base class for warnings about deprecated schema features.

SchemaDeprecationWarning1Dot7

Class for warnings about deprecated schema features in CycloneDX 1.7

SchemaDeprecationWarning1Dot6

Class for warnings about deprecated schema features in CycloneDX 1.6

SchemaDeprecationWarning1Dot5

Class for warnings about deprecated schema features in CycloneDX 1.5

SchemaDeprecationWarning1Dot4

Class for warnings about deprecated schema features in CycloneDX 1.4

SchemaDeprecationWarning1Dot3

Class for warnings about deprecated schema features in CycloneDX 1.3

SchemaDeprecationWarning1Dot2

Class for warnings about deprecated schema features in CycloneDX 1.2

SchemaDeprecationWarning1Dot1

Class for warnings about deprecated schema features in CycloneDX 1.1

Module Contents

exception cyclonedx.schema.deprecation.BaseSchemaDeprecationWarning

Bases: DeprecationWarning, abc.ABC

Base class for warnings about deprecated schema features.

SCHEMA_VERSION: ClassVar[cyclonedx.schema.SchemaVersion]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot7

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.7

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_7]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot6

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.6

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_6]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot5

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.5

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_5]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot4

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.4

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_4]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot3

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.3

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_3]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot2

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.2

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_2]]
exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot1

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.1

SCHEMA_VERSION: ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_1]]