Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when using schema features annotated with "deprecated": true #331

Open
edgarrmondragon opened this issue Sep 27, 2023 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@edgarrmondragon
Copy link
Contributor

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]

It'd be nice if the CLI could emit warnings regarding deprecated features.

@sirosen
Copy link
Member

sirosen commented Sep 27, 2023

Cool idea. I'll need to look into how we could gather up this info. I'm not sure when I could prioritize working on this, but certainly I'd be open to a PR or useful info about how to implement it on top of jsonschema.

@sirosen sirosen added the enhancement New feature or request label Sep 27, 2023
@edgarrmondragon
Copy link
Contributor Author

edgarrmondragon commented Sep 28, 2023

Ha, I don't know why I didn't think of first opening an issue over there. Thanks!

UPDATE: python-jsonschema/jsonschema#1170

@sirosen sirosen added the requires-jsonschema-changes Needs changes or new features in the jsonschema library label Sep 29, 2023
@sirosen sirosen removed the requires-jsonschema-changes Needs changes or new features in the jsonschema library label Oct 1, 2023
@sirosen
Copy link
Member

sirosen commented Oct 1, 2023

I'm removing the label for requiring an upstream change after the pretty productive thread on jsonschema. Short term, it's probably wiser not to wait for an ideal solution but to try to do something as a client of that lib.

The main questions I have coming out of that is

  • is erroring on deprecations acceptable?
  • what's the right interface for also supporting other advisory annotations as errors?

If erroring out isn't okay, it's going to be extremely hard to support this (I'd say infeasible). If it is, then just to consider and play around with a phrasing...

check-jsonschema --reject deprecated,readOnly

Looks decent to me. I like the brevity of --reject as a name for it, but it could also be something like --error-on.

@emilal
Copy link

emilal commented Mar 7, 2024

The main questions I have coming out of that is

  • is erroring on deprecations acceptable?

My expectation would be that they're warnings by default (and could become errors in a strict mode).

That is also generally the use case for deprecations: Using the feature isn't an error, but will likely become so in the future, and it is desirable for users of the feature to find some alternate solution.

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

No branches or pull requests

3 participants