redhat-developer / redhat-developer/vscode-yaml
Managing priority in the selection of validation schemas
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 830
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Is your enhancement related to a problem? Please describe.
I encountered a problem selecting a validation schema that took me some time to diagnose...
I had a declaration at both the Workspace level (file /.vscode/settings.json) and the User level (file /user_preferences_folder/settings.json).
Both declarations targeted the same YAML files for validation, but the validation schemes differed in the two settings.json files:
- The validation schema for the user's settings.json file had a lower classifying name than the validation schema for the workspace's settings.json file.
- Therefore, the validation schema for the user's settings.json file was taken into account, while the validation schema for the workspace's settings.json file was ignored.
- This is not consistent with the usual precedence rules for information declared in settings.json files.
The problem is that apparently the "property" key takes precedence over the value associated with the key in taking settings into account, but the search seems to be done in relation to the value of the property (in this case the yaml file to be validated).
Describe the solution you would like
To avoid these problems, where multiple schemas can be candidate for a file to be validated, it would be necessary to define a priority at the "schema/globPattern" association declaration level.
Describe alternatives you have considered
Additional context
Workspace settings.json:
"yaml.schemas": {"schema-1.2.0.jon": [*kind.yaml]}
User settings.json:
"yaml.schemas": {"schema-1.1.0.json": [*kind.yaml]}
--> User schema is selected instead of Workspace schema, because "1.1.0" is less than "1.2.0".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the conflict using the workspace /.vscode/settings.json and user /user_preferences_folder/settings.json examples in the issue. Trace how competing yaml.schemas associations are selected and how settings precedence is applied. Done means the issue's proposed schema/globPattern priority behavior is defined and validated for multiple candidate schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100