Skip to content

Fix StackOverflow when selecting a schema for a YAML file that matches multiple schemas#1253

Merged
datho7561 merged 7 commits into
redhat-developer:mainfrom
shin19991207:fix-1249
May 25, 2026
Merged

Fix StackOverflow when selecting a schema for a YAML file that matches multiple schemas#1253
datho7561 merged 7 commits into
redhat-developer:mainfrom
shin19991207:fix-1249

Conversation

@shin19991207
Copy link
Copy Markdown
Member

@shin19991207 shin19991207 commented May 21, 2026

What does this PR do?

yaml-language-server supports validating a YAML file against multiple matching JSON schemas by creating an internal combined schema with JSON Schema allOf. Because multiple schemas can be valid for one YAML file, the schema picker should allow users to select or deselect multiple schemas instead of forcing a single choice.

This PR updates the schema picker behavior:

  • supports selecting/deselecting multiple schemas from the schema picker
  • treats "No JSON Schema" option as an override: if selected, other schema selections are ignored and schema detection is disabled for the current YAML file.
  • status bar is updated when a modeline schema is added or changed in the current YAML file
  • changed version selection to a per-schema action: to select a schema version, hover over a schema name in the picker, click the versions icon on the right to choose/see available versions:
    Screenshot 2026-05-22 at 2 00 43 PM

What issues does this PR fix or reference?

Fixes #1249
Fixes #983
Related to redhat-developer/yaml-language-server#1260

Is it tested? How?

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
@shin19991207 shin19991207 marked this pull request as ready for review May 22, 2026 18:10
@shin19991207 shin19991207 requested a review from datho7561 as a code owner May 22, 2026 18:10
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
@datho7561
Copy link
Copy Markdown
Contributor

I was able to select "No Schema" in addition to two schemas. I think it's not evident what this does to the end user. Maybe it's worth deselecting the other schemas when you select "No Schema"

@datho7561
Copy link
Copy Markdown
Contributor

Looks pretty good from my testing, outside of #1253 (comment) which I think will be confusing for users and could be improved.

…" is selected

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
@shin19991207
Copy link
Copy Markdown
Member Author

@datho7561 Thanks for the review and the suggestion! I updated the behavior now:

  • selecting "No JSON Schema" clears all other selected schemas immediately
  • selecting a schema while "No JSON Schema" is selected clears "No JSON Schema" immediately
  • if everything is deselected, the picker auto-selects "No JSON Schema"

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Copy link
Copy Markdown
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks, Morgan!

@datho7561 datho7561 merged commit ed60d53 into redhat-developer:main May 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants