Skip to content

feat: make schema deprecation warnings handle-able#945

Open
jkowalleck wants to merge 13 commits intomainfrom
feat/dedicated-deprecation-error-types
Open

feat: make schema deprecation warnings handle-able#945
jkowalleck wants to merge 13 commits intomainfrom
feat/dedicated-deprecation-error-types

Conversation

@jkowalleck
Copy link
Member

@jkowalleck jkowalleck commented Mar 12, 2026

Description

Introduced cyclonedx.schema.deprecation.BaseSchemaDeprecationWarning and version-specific subclasses (e.g., for schema 1.1, 1.2).
Deprecated features in CycloneDX schemas now issue warnings using these custom warning classes instead of Python's built-in DeprecationWarning.
Downstream code can now filter or suppress schema-related deprecation warnings by category.

see our examples. usage like so

import warnings

import cyclonedx.schema.deprection.BaseSchemaDeprecationWarning

with warnings.catch_warnings():
    warnings.simplefilter("ignore", categpry=cyclonedx.schema.deprection.BaseSchemaDeprecationWarning)
    bom_from_xml = Bom.from_xml(...)

closes #944

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: [e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.]
    • LLMs and versions: [e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.]
    • Prompts: [Summarize the key prompts or instructions given to the AI tools]

Affirmation

@jkowalleck jkowalleck requested a review from a team as a code owner March 12, 2026 22:51
@jkowalleck jkowalleck added the enhancement New feature or request label Mar 12, 2026
@read-the-docs-community
Copy link

read-the-docs-community bot commented Mar 12, 2026

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #31791935 | 📁 Comparing c551d50 against latest (6460b71)


🔍 Preview build

Show files changed (7 files in total): 📝 6 modified | ➕ 1 added | ➖ 0 deleted
File Status
examples.html 📝 modified
genindex.html 📝 modified
py-modindex.html 📝 modified
autoapi/index.html 📝 modified
autoapi/cyclonedx/schema/index.html 📝 modified
autoapi/cyclonedx/schema/deprecation/index.html ➕ added
autoapi/cyclonedx/schema/schema/index.html 📝 modified

@codacy-production
Copy link

codacy-production bot commented Mar 12, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.03% 97.06% (target: 80.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (44f1273) 5908 5561 94.13%
Head commit (c551d50) 5937 (+29) 5590 (+29) 94.16% (+0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#945) 34 33 97.06%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@jkowalleck jkowalleck force-pushed the feat/dedicated-deprecation-error-types branch from dff4254 to 70ce15d Compare March 12, 2026 23:03
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck jkowalleck force-pushed the feat/dedicated-deprecation-error-types branch from 70ce15d to 196424e Compare March 12, 2026 23:14
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck jkowalleck marked this pull request as ready for review March 13, 2026 09:33
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck
Copy link
Member Author

@stefan6419846, could I ask you for a review?
If the implementation looks about right, I will draft a preview release you may try in your environment.

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Copy link
Contributor

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good for me.

If the implementation looks about right, I will draft a preview release you may try in your environment.

From my side, there is no explicit need for a preview release - I am completely fine to include a regular release once available.

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck
Copy link
Member Author

I think the feature is complete.
Will let it sink over the weekend and might cut a release early next week.

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation warnings are shown for wrong version

2 participants