Merge pull request #1709 from github/charis-nora/validate-db-config-file

Validate workspace-databases.json
This commit is contained in:
Nora
2022-11-04 12:20:20 +01:00
committed by GitHub
4 changed files with 58 additions and 1 deletions

View File

@@ -15,7 +15,8 @@ const packageFiles = [
'snippets.json',
'media',
'node_modules',
'out'
'out',
'workspace-databases-schema.json'
];
async function copyPackage(sourcePath: string, destPath: string): Promise<void> {

View File

@@ -84,6 +84,12 @@
"editor.wordBasedSuggestions": false
}
},
"jsonValidation": [
{
"fileMatch": "workspace-databases.json",
"url": "./workspace-databases-schema.json"
}
],
"languages": [
{
"id": "ql",

View File

@@ -12,6 +12,7 @@ export class DbConfigStore extends DisposableObject {
public constructor(workspaceStoragePath: string) {
super();
this.configPath = path.join(workspaceStoragePath, 'workspace-databases.json');
this.config = this.createEmptyConfig();

View File

@@ -0,0 +1,49 @@
{
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"remote": {
"type": "object",
"properties": {
"repositoryLists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"repositories": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+/[a-zA-Z0-9-_\\.]+$"
}
}
},
"required": ["name", "repositories"],
"additionalProperties": false
}
},
"owners": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+$"
}
},
"repositories": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+/[a-zA-Z0-9-_\\.]+$"
}
}
},
"required": ["repositoryLists", "owners", "repositories"],
"additionalProperties": false
}
}
}