Merge pull request #1709 from github/charis-nora/validate-db-config-file
Validate workspace-databases.json
This commit is contained in:
@@ -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> {
|
||||
|
||||
@@ -84,6 +84,12 @@
|
||||
"editor.wordBasedSuggestions": false
|
||||
}
|
||||
},
|
||||
"jsonValidation": [
|
||||
{
|
||||
"fileMatch": "workspace-databases.json",
|
||||
"url": "./workspace-databases-schema.json"
|
||||
}
|
||||
],
|
||||
"languages": [
|
||||
{
|
||||
"id": "ql",
|
||||
|
||||
@@ -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();
|
||||
|
||||
49
extensions/ql-vscode/workspace-databases-schema.json
Normal file
49
extensions/ql-vscode/workspace-databases-schema.json
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user