Skip to content

Commit bb23de9

Browse files
committed
Fix the qlpack json schema
This schema was incorrectly tagging `defaultSuite` properties that aren't arrays as errors. I think there are more, similar errors in this schema, but I only fixed this one so that I can get `github/semmle-code` working with test discovery.
1 parent a5239fb commit bb23de9

4 files changed

Lines changed: 73 additions & 27 deletions

File tree

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
"$ref": "#/definitions/SuiteInstruction"
6868
}
6969
},
70+
{
71+
"$ref": "#/definitions/SuiteInstruction"
72+
},
7073
{
7174
"type": "null"
7275
}
@@ -91,22 +94,42 @@
9194
"type": "string"
9295
},
9396
"include": {
94-
"type": "object",
95-
"additionalProperties": {
96-
"type": "array",
97-
"items": {
98-
"type": "string"
97+
"anyOf": [
98+
{
99+
"type": "object",
100+
"additionalProperties": {
101+
"type": "array",
102+
"items": {
103+
"type": "string"
104+
}
105+
}
106+
},
107+
{
108+
"type": "object",
109+
"additionalProperties": {
110+
"type": "string"
111+
}
99112
}
100-
}
113+
]
101114
},
102115
"exclude": {
103-
"type": "object",
104-
"additionalProperties": {
105-
"type": "array",
106-
"items": {
107-
"type": "string"
116+
"anyOf": [
117+
{
118+
"type": "object",
119+
"additionalProperties": {
120+
"type": "array",
121+
"items": {
122+
"type": "string"
123+
}
124+
}
125+
},
126+
{
127+
"type": "object",
128+
"additionalProperties": {
129+
"type": "string"
130+
}
108131
}
109-
}
132+
]
110133
},
111134
"description": {
112135
"type": "string"

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"$ref": "#/definitions/SuiteInstruction"
5252
}
5353
},
54+
{
55+
"$ref": "#/definitions/SuiteInstruction"
56+
},
5457
{
5558
"type": "null"
5659
}
@@ -91,22 +94,42 @@
9194
"type": "string"
9295
},
9396
"include": {
94-
"type": "object",
95-
"additionalProperties": {
96-
"type": "array",
97-
"items": {
98-
"type": "string"
97+
"anyOf": [
98+
{
99+
"type": "object",
100+
"additionalProperties": {
101+
"type": "array",
102+
"items": {
103+
"type": "string"
104+
}
105+
}
106+
},
107+
{
108+
"type": "object",
109+
"additionalProperties": {
110+
"type": "string"
111+
}
99112
}
100-
}
113+
]
101114
},
102115
"exclude": {
103-
"type": "object",
104-
"additionalProperties": {
105-
"type": "array",
106-
"items": {
107-
"type": "string"
116+
"anyOf": [
117+
{
118+
"type": "object",
119+
"additionalProperties": {
120+
"type": "array",
121+
"items": {
122+
"type": "string"
123+
}
124+
}
125+
},
126+
{
127+
"type": "object",
128+
"additionalProperties": {
129+
"type": "string"
130+
}
108131
}
109-
}
132+
]
110133
},
111134
"description": {
112135
"type": "string"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface QlPackFile {
1010
extensionTargets?: Record<string, string> | null;
1111
dbscheme?: string | null;
1212
library?: boolean | null;
13-
defaultSuite?: SuiteInstruction[] | null;
13+
defaultSuite?: SuiteInstruction[] | SuiteInstruction | null;
1414
defaultSuiteFile?: string | null;
1515
dataExtensions?: string[] | string | null;
1616
}

extensions/ql-vscode/src/packaging/suite-instruction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export interface SuiteInstruction {
55
qlpack?: string;
66
query?: string;
77
queries?: string;
8-
include?: Record<string, string[]>;
9-
exclude?: Record<string, string[]>;
8+
include?: Record<string, string[]> | Record<string, string>;
9+
exclude?: Record<string, string[]> | Record<string, string>;
1010
description?: string;
1111
import?: string;
1212
from?: string;

0 commit comments

Comments
 (0)