python-jsonschema / python-jsonschema/jsonschema

Support encountering of a `"deprecated": true` keyword by propagating a deprecation warning

Open
#1,170 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dialects v2 Enhancement
Dominant language
Python
Stars
5k
Forks
671
Avg merge
1d 1h
Merged PRs (30d)
10

Description

New in draft 2019-09 The deprecated keyword is a boolean that indicates that the instance value the keyword applies to should not be used and may be removed in the future.[1]

Usage example:

from jsonschema import validators

schema = {
    "properties": {
        "id": {"type": "integer"},
        "name": {"type": "string", "deprecated": True},
    },
}
instance={"id": 1, "name": "abc"}
validator = validators.Draft202012Validator(schema, check_deprecated=True)

validator.validate(instance)  # raises ValidationError

I can start working on a PR if the maintainers are interested and the suggested API makes sense.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with validators.Draft202012Validator and its validate entry point, then trace how keyword annotations are handled. Clarify and test the requested check_deprecated behavior, including whether a deprecated property should produce a warning or the ValidationError shown in the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.