microsoft / microsoft/pyright

Ignore unknown key `"$schema"` in schema validation

Open
#11,182 0 comments 1 reaction 0 assignees View on GitHub
enhancement request
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

Following https://github.com/microsoft/pyright/issues/11040 / https://github.com/microsoft/pyright/issues/11045, I now get `Config contains unrecognized setting "$schema"` in a few projects, including typeshed.

Whilst it's true that `The pyright VS Code extension ships with a JSON schema for "pyrightconfig.json",`, that doesn't work for config files names slightly differently or if not specifically using VSCode w/ Pylance.

That is easy to solve by explicitly setting the schema with `$schema`, but that now prints a warning.

Examples of config files named differently (for additional tests that can't all be configured in 1 file):
- https://github.com/python/typeshed/blob/90d855985be5aae9bc76e77b0f3d4b6738c38347/pyrightconfig.testcases.json#L2
- https://github.com/python/typeshed/blob/90d855985be5aae9bc76e77b0f3d4b6738c38347/pyrightconfig.stricter.json#L2
- https://github.com/python/typeshed/blob/90d855985be5aae9bc76e77b0f3d4b6738c38347/pyrightconfig.scripts_and_tests.json#L2
- https://github.com/Avasam/pywin32/blob/957453619183b2a9df98872066a1a15953cada05/pyrightconfig.adodbapi.json#L2

Contributor guide

Open the contributing guide

Research direction

Start by reproducing validation with the listed pyrightconfig.testcases.json and similarly named configuration files that contain "$schema". Trace the configuration-setting validation path, then verify that "$schema" no longer produces an unrecognized-setting warning while other unknown settings remain validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.