Skip to content

Commit

Permalink
Fix the qlpack json schema
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aeisenberg committed Mar 29, 2024
1 parent a5239fb commit bb23de9
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
"$ref": "#/definitions/SuiteInstruction"
}
},
{
"$ref": "#/definitions/SuiteInstruction"
},
{
"type": "null"
}
Expand All @@ -91,22 +94,42 @@
"type": "string"
},
"include": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
]
},
"exclude": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
]
},
"description": {
"type": "string"
Expand Down
47 changes: 35 additions & 12 deletions extensions/ql-vscode/src/packaging/qlpack-file.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"$ref": "#/definitions/SuiteInstruction"
}
},
{
"$ref": "#/definitions/SuiteInstruction"
},
{
"type": "null"
}
Expand Down Expand Up @@ -91,22 +94,42 @@
"type": "string"
},
"include": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
]
},
"exclude": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
]
},
"description": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/packaging/qlpack-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface QlPackFile {
extensionTargets?: Record<string, string> | null;
dbscheme?: string | null;
library?: boolean | null;
defaultSuite?: SuiteInstruction[] | null;
defaultSuite?: SuiteInstruction[] | SuiteInstruction | null;
defaultSuiteFile?: string | null;
dataExtensions?: string[] | string | null;
}
4 changes: 2 additions & 2 deletions extensions/ql-vscode/src/packaging/suite-instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export interface SuiteInstruction {
qlpack?: string;
query?: string;
queries?: string;
include?: Record<string, string[]>;
exclude?: Record<string, string[]>;
include?: Record<string, string[]> | Record<string, string>;
exclude?: Record<string, string[]> | Record<string, string>;
description?: string;
import?: string;
from?: string;
Expand Down

0 comments on commit bb23de9

Please sign in to comment.