Anchor on property which uses alias fails validation
See original GitHub issueSchema:
{
"title": "Field definitions schema!",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"field": {
"type": "object",
"additionalProperties": false,
"required": ["label"],
"properties": {
"label": { "type": "string" }
}
},
"model": {
"type": "object",
"additionalProperties": false,
"properties": {
"props": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/field" }
}
}
}
},
"type": "object",
"additionalProperties": { "$ref": "#/definitions/model" }
}
Document:
Named:
props: &NamedProps
name:
label: Name
Timestamped:
props: &TimestampedProps
<<: *NamedProps
ts:
label: Timestamp
Record:
props:
<<: *TimestampedProps # commenting out this line removes the errors
id:
label: ID
Looks like it’s incorrectly adding a layer of nesting or something?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Schema validation doesn't work with YAML Aliases #183
YAML supports anchors and aliases, which allow nodes to be repeated in the YAML structure. This Swagger spec should be allowed, but fails...
Read more >Advanced YAML syntax cheatsheet - Educative.io
Anchors and Aliases are YAML constructions that allow you to reduce repeat syntax and extend existing data nodes. You can place Anchors (...
Read more >YAML Anchor, Aliases and Merge Keys
Schema-validation of a YAML document is only possible when all references and merge keys are represented. However, it is not that every schema-validator...
Read more >Optimize GitLab CI/CD configuration files
You can reduce complexity and duplicated configuration in your GitLab CI/CD configuration files by using: YAML-specific features like anchors ( & ), aliases...
Read more >No key with alias found in keystore - Stack Overflow
The problem seems to be with the wrongly spelled key alias In my case the alias should have been toyanath patro where I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I haven’t been able to look into it but my hunch is that the first merge key is being properly expanded but the second one isn’t, leading to the error. The code that does that is here: https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/parser/jsonParser07.ts#L951 if you want to poke around
Anything I can do to help? My yamls are all red 😦