From Gary Court:
Answer from Eric Hartford on Stack OverflowI personally use .schema.json, but there is no official file extension. The official mime type however is "application/schema+json".
From Gary Court:
I personally use .schema.json, but there is no official file extension. The official mime type however is "application/schema+json".
Update 2022Nov
application/schema+json and application/schema-instance+json will be published by an IETF RFC.
According to current proposal, both json and schema.json extensions are supported. I still find it quite inconvenient for processing based on conventions to have a dot within an extension.
Previous comment
According to the last draft (v4), there is not a new extension proposed for files storing json-schemas. .json extension is used profusely within that document. .json is also the preferred extension in validators (PHP, Ruby, Python).
So I think that .json should be the preferred option in absence of an official/standard new extension.
Videos
From Gary Court:
Answer from Eric Hartford on Stack OverflowI personally use .schema.json, but there is no official file extension. The official mime type however is "application/schema+json".
Hello everyone, I am writing a CLI tool that will have a fairly complex yaml configuration, so I wanted to create a VSCode extension to support that with completion provided by the JSON Schema and some snippets, but it seems not to work.
This is my package.json:
{
"name": "lake-config",
"displayName": "Lake Configuration Helper",
"publisher": "essay97",
"description": "Provides schema validation and snippets to configure Lake",
"version": "0.0.1",
"engines": {
"vscode": "^1.80.0"
},
"categories": [
"Other"
],
"activationEvents": [],
"main": "./extension.js",
"contributes": {
"languages": [
{
"id": "yaml",
"extensions": [
".lake"
],
"aliases": [
"Lake Config"
]
}
],
"jsonValidation": [
{
"fileMatch": "**/*.lake",
"url": "./lake-schema.json"
}
]
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "node ./test/runTest.js"
},
"devDependencies": {
"@types/vscode": "^1.84.0",
"@types/mocha": "^10.0.3",
"@types/node": "18.x",
"eslint": "^8.52.0",
"glob": "^10.3.10",
"mocha": "^10.2.0",
"typescript": "^5.2.2",
"@vscode/test-electron": "^2.3.6"
}
}When I try to open an extension development host with F5 and open a .lake file, I get the YAML syntax highlighting, but not the JSON Schema, the bottom bar says "no json schema".
What am I missing? I even tried to set the jsonValidation.url to a random json schema from the internet to make sure it was not a problem in my schema but it's still not working.
Also: I'm not sure if I should depend on redhat.vscode-yaml. extension and what extensionDependencies does exactly.
Thanks in advance!
EDIT: I forgot one last doubt. It seems to me that snippets are bound to languages, but I don't like the idea of polluting the YAML environment with my snippets. Is there any way to define a "lake" language that inherits everything from yaml, kind of a "sub-language"?