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

mypy schema: Support show_error_codes, show_error_code_links #3467

Closed
hyperupcall opened this issue Dec 21, 2023 · 4 comments · Fixed by #3472
Closed

mypy schema: Support show_error_codes, show_error_code_links #3467

hyperupcall opened this issue Dec 21, 2023 · 4 comments · Fixed by #3472
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)

Comments

@hyperupcall
Copy link
Member

Area with issue?

JSON Schema

✔️ Expected Behavior

Properties on the mypy such as show_error_codes and show_error_code_links are used, the schema should work.

❌ Actual Behavior

An error is raised: additional properties are not allowed

More info here

YAML or JSON file that does not work.

mypy.json

IDE or code editor.

None

Are you making a PR for this?

No, someone else must create the PR.

@hyperupcall hyperupcall added the issue:bug Report errors or unexpected behavior (auto-generated by issue forms) label Dec 21, 2023
@henryiii
Copy link
Contributor

show_error_codes is deprecated and undocumented. What's the recommendation for that? 95% of the time, it can just be removed, as it's been the default since before mypy 1. (If it was explicitly listed and off, then hide_error_codes = true can be used).

show_error_code_links is undocumented, and I only processed the documentation. Maybe it should be added to the docs? I can look into that soon-ish.

@hyperupcall
Copy link
Member Author

hyperupcall commented Dec 21, 2023

Ah, so they're both undocumented and one is deprecated. For a while this project has not allowed including undocumented features, but I've been moving towards the opposite direction. More info at #3372, but long story short, it improves the experience when the JSON Schema doesn't show an error for something that is actually accepted by the tool (even if deprecated or undocumented). As a result, we no longer require all properties to be documented :)

So I think it would be best to change the schema so that these errors are fixed. At a minimum, the properties can be added, and their descriptions can at least include "UNDOCUMENTED" or "DEPRECATED". I added a little documentation here, but I think it's kind of hidden

@henryiii
Copy link
Contributor

What about adding deprecated: true as in

"deprecated": true,
? (It's not technically part of draft 7)

@hyperupcall
Copy link
Member Author

hyperupcall commented Dec 21, 2023

That could be added too - as far as I know, it is not a violation of the specification to include "unknown properties" (like "deprecated" for draft-07) in the schema. I didn't mention it at first because it is excluded in draft-07 - because of this, I think json schema parsers would ignore it and the end user would have no way of knowing it is deprecated (unless it is in description or something).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants