Skip to content

Commit e5ffdd0

Browse files
committed
Use correct types for qlpack file
The qlpack file is allowed to have null values for fields, instead of them being absent. This adds the correct types to the qlpack file schema.
1 parent 2c7b67e commit e5ffdd0

File tree

3 files changed

+91
-43
lines changed

3 files changed

+91
-43
lines changed

extensions/ql-vscode/src/model-editor/extension-pack-metadata.schema.json

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,23 @@
66
"type": "object",
77
"properties": {
88
"name": {
9-
"type": "string"
9+
"type": ["string", "null"]
1010
},
1111
"version": {
12-
"type": "string"
12+
"type": ["string", "null"]
1313
},
1414
"extensionTargets": {
15-
"type": "object",
16-
"additionalProperties": {
17-
"type": "string"
18-
}
15+
"anyOf": [
16+
{
17+
"type": "object",
18+
"additionalProperties": {
19+
"type": "string"
20+
}
21+
},
22+
{
23+
"type": "null"
24+
}
25+
]
1926
},
2027
"dataExtensions": {
2128
"anyOf": [
@@ -27,29 +34,46 @@
2734
},
2835
{
2936
"type": "string"
37+
},
38+
{
39+
"type": "null"
3040
}
3141
]
3242
},
3343
"dependencies": {
34-
"type": "object",
35-
"additionalProperties": {
36-
"type": "string"
37-
}
44+
"anyOf": [
45+
{
46+
"type": "object",
47+
"additionalProperties": {
48+
"type": "string"
49+
}
50+
},
51+
{
52+
"type": "null"
53+
}
54+
]
3855
},
3956
"dbscheme": {
40-
"type": "string"
57+
"type": ["string", "null"]
4158
},
4259
"library": {
43-
"type": "boolean"
60+
"type": ["boolean", "null"]
4461
},
4562
"defaultSuite": {
46-
"type": "array",
47-
"items": {
48-
"$ref": "#/definitions/SuiteInstruction"
49-
}
63+
"anyOf": [
64+
{
65+
"type": "array",
66+
"items": {
67+
"$ref": "#/definitions/SuiteInstruction"
68+
}
69+
},
70+
{
71+
"type": "null"
72+
}
73+
]
5074
},
5175
"defaultSuiteFile": {
52-
"type": "string"
76+
"type": ["string", "null"]
5377
}
5478
},
5579
"required": ["dataExtensions", "extensionTargets", "name", "version"]

extensions/ql-vscode/src/packaging/qlpack-file.schema.json

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,58 @@
66
"type": "object",
77
"properties": {
88
"name": {
9-
"type": "string"
9+
"type": ["string", "null"]
1010
},
1111
"version": {
12-
"type": "string"
12+
"type": ["string", "null"]
1313
},
1414
"dependencies": {
15-
"type": "object",
16-
"additionalProperties": {
17-
"type": "string"
18-
}
15+
"anyOf": [
16+
{
17+
"type": "object",
18+
"additionalProperties": {
19+
"type": "string"
20+
}
21+
},
22+
{
23+
"type": "null"
24+
}
25+
]
1926
},
2027
"extensionTargets": {
21-
"type": "object",
22-
"additionalProperties": {
23-
"type": "string"
24-
}
28+
"anyOf": [
29+
{
30+
"type": "object",
31+
"additionalProperties": {
32+
"type": "string"
33+
}
34+
},
35+
{
36+
"type": "null"
37+
}
38+
]
2539
},
2640
"dbscheme": {
27-
"type": "string"
41+
"type": ["string", "null"]
2842
},
2943
"library": {
30-
"type": "boolean"
44+
"type": ["boolean", "null"]
3145
},
3246
"defaultSuite": {
33-
"type": "array",
34-
"items": {
35-
"$ref": "#/definitions/SuiteInstruction"
36-
}
47+
"anyOf": [
48+
{
49+
"type": "array",
50+
"items": {
51+
"$ref": "#/definitions/SuiteInstruction"
52+
}
53+
},
54+
{
55+
"type": "null"
56+
}
57+
]
3758
},
3859
"defaultSuiteFile": {
39-
"type": "string"
60+
"type": ["string", "null"]
4061
},
4162
"dataExtensions": {
4263
"anyOf": [
@@ -48,6 +69,9 @@
4869
},
4970
{
5071
"type": "string"
72+
},
73+
{
74+
"type": "null"
5175
}
5276
]
5377
}

extensions/ql-vscode/src/packaging/qlpack-file.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { SuiteInstruction } from "./suite-instruction";
44
* The qlpack pack file, either in qlpack.yml or in codeql-pack.yml.
55
*/
66
export interface QlPackFile {
7-
name?: string;
8-
version?: string;
9-
dependencies?: Record<string, string>;
10-
extensionTargets?: Record<string, string>;
11-
dbscheme?: string;
12-
library?: boolean;
13-
defaultSuite?: SuiteInstruction[];
14-
defaultSuiteFile?: string;
15-
dataExtensions?: string[] | string;
7+
name?: string | null;
8+
version?: string | null;
9+
dependencies?: Record<string, string> | null;
10+
extensionTargets?: Record<string, string> | null;
11+
dbscheme?: string | null;
12+
library?: boolean | null;
13+
defaultSuite?: SuiteInstruction[] | null;
14+
defaultSuiteFile?: string | null;
15+
dataExtensions?: string[] | string | null;
1616
}

0 commit comments

Comments
 (0)