-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Describe the bug
The YAML Language Server shows a schema validation error when encountering custom tag !include. While the underlying parser correctly accepts the !include tag as valid YAML, the schema validator fails to interpret the tag's value. Instead of understanding that !include ./libs.yaml resolves to an object, the validator tries to validate the literal string ./libs.yaml against the schema's type definition, which expects a full object. This creates a false positive error that breaks validation
Expected Behavior
The validation error is a false positive,
Current Behavior
The schema validator does not process the custom tag. It sees the !include tag's value ./libs.yaml as the final value. It then tries to validate that this string against the schema's "type": "object" requirement, which fails.
Steps to Reproduce
- Using the following schema :
{
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"libs": {
"type": "object",
"description": "Library definitions",
"additionalProperties": {
"$ref": "#/$defs/library"
}
},
}
}- Create main YAML file associated with the schema
libs: !include ./libs.yaml- The YAML LS will report an error similar to:
Incorrect type. Expected "object". [YAML Schema]
Environment
- Windows
- Mac
- Linux
- other (please specify)
- Extension version : 1.18.0
- Vscode version : 1.103.2