Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kylemit/yamlschematestcases
Test cases for vscode-yaml
https://github.com/kylemit/yamlschematestcases
demo-app json-schema yaml
Last synced: 21 days ago
JSON representation
Test cases for vscode-yaml
- Host: GitHub
- URL: https://github.com/kylemit/yamlschematestcases
- Owner: KyleMit
- Created: 2019-08-26T17:56:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-02-13T16:59:41.000Z (almost 3 years ago)
- Last Synced: 2024-12-15T09:32:02.166Z (22 days ago)
- Topics: demo-app, json-schema, yaml
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# Test Cases for Yaml Schema Validation
Test cases for [vscode-yaml](https://github.com/redhat-developer/vscode-yaml) and [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) comparing validation and syntax highlighting output between JSON and YAML files
## Resources & Refernces
* Spec
* [6.6 Keywords for Applying Subschemas Conditionally](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6)
* [6.7 Keywords for Applying Subschemas With Boolean Logic](http://json-schema.org/latest/json-schema-validation.html#logic)* Guides
* [Applying subschemas conditionally](https://json-schema.org/understanding-json-schema/reference/conditionals.html)
* [Combining schemas](https://json-schema.org/understanding-json-schema/reference/combining.html)
* [Schema Dependencies](https://json-schema.org/understanding-json-schema/reference/object.html#schema-dependencies)* Stack Overflow
* [JsonSchema - conditionally require attribute](https://stackoverflow.com/a/38781027/1366033)## Tests
### Conditionally Require Field
### Conditionally Require Field ... Results
| Lang | Expected | Passed |
| ---- | ---------------------- | ------ |
| Yaml | Require prop "options" | ✅ |
| Json | Require prop "options" | ✅ |![screenshot](https://i.imgur.com/p8sNT7n.png)
### Conditionally Require Field .... with `if...then`
```json
"if": {
"properties": {
"controlType": {"const": "dropdown"}
}
},
"then": {
"required": ["options"]
}
```### Conditionally Require Field .... with `anyOf` or `oneOf`
```json
"oneOf": [
{
"properties": {
"controlType": {"const": "dropdown"}
},
"required": ["options"]
},
{
"properties": {
"controlType": {"const": "button"}
}
}
]
```## Conditionally Add Property
### Conditionally Add Property ... Results
![screenshot](https://i.imgur.com/HmWFCjY.png)
| Lang | Expected | Passed |
| ---- | -------------------------- | ------ |
| Yaml | Autocomplete for "options" | ❌ |
| Json | Autocomplete for "options" | ✅ |### Conditionally Add Property ... with `if...then`
```json
"if": {
"properties": {
"controlType": {"const": "dropdown"}
}
},
"then": {
"properties": {
"options": {
"type": "array",
"items": {"type": "string"}
}
}
}
```### Conditionally Add Property ... with `anyOf` or `oneOf`
```json
"oneOf": [
{
"properties": {
"controlType": {"const": "dropdown"},
"options": {
"type": "array",
"items": {"type": "string"}
}
},
"required": ["options"]
},
{
"properties": {
"controlType": {"const": "button"}
}
}
]
```