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.
This commit is contained in:
Koen Vlaswinkel
2024-01-02 16:25:44 +01:00
parent 2c7b67e2a4
commit e5ffdd0fbc
3 changed files with 91 additions and 43 deletions

View File

@@ -6,16 +6,23 @@
"type": "object",
"properties": {
"name": {
"type": "string"
"type": ["string", "null"]
},
"version": {
"type": "string"
"type": ["string", "null"]
},
"extensionTargets": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"dataExtensions": {
"anyOf": [
@@ -27,29 +34,46 @@
},
{
"type": "string"
},
{
"type": "null"
}
]
},
"dependencies": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"dbscheme": {
"type": "string"
"type": ["string", "null"]
},
"library": {
"type": "boolean"
"type": ["boolean", "null"]
},
"defaultSuite": {
"type": "array",
"items": {
"$ref": "#/definitions/SuiteInstruction"
}
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/SuiteInstruction"
}
},
{
"type": "null"
}
]
},
"defaultSuiteFile": {
"type": "string"
"type": ["string", "null"]
}
},
"required": ["dataExtensions", "extensionTargets", "name", "version"]

View File

@@ -6,37 +6,58 @@
"type": "object",
"properties": {
"name": {
"type": "string"
"type": ["string", "null"]
},
"version": {
"type": "string"
"type": ["string", "null"]
},
"dependencies": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"extensionTargets": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"anyOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"dbscheme": {
"type": "string"
"type": ["string", "null"]
},
"library": {
"type": "boolean"
"type": ["boolean", "null"]
},
"defaultSuite": {
"type": "array",
"items": {
"$ref": "#/definitions/SuiteInstruction"
}
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/SuiteInstruction"
}
},
{
"type": "null"
}
]
},
"defaultSuiteFile": {
"type": "string"
"type": ["string", "null"]
},
"dataExtensions": {
"anyOf": [
@@ -48,6 +69,9 @@
},
{
"type": "string"
},
{
"type": "null"
}
]
}

View File

@@ -4,13 +4,13 @@ import { SuiteInstruction } from "./suite-instruction";
* The qlpack pack file, either in qlpack.yml or in codeql-pack.yml.
*/
export interface QlPackFile {
name?: string;
version?: string;
dependencies?: Record<string, string>;
extensionTargets?: Record<string, string>;
dbscheme?: string;
library?: boolean;
defaultSuite?: SuiteInstruction[];
defaultSuiteFile?: string;
dataExtensions?: string[] | string;
name?: string | null;
version?: string | null;
dependencies?: Record<string, string> | null;
extensionTargets?: Record<string, string> | null;
dbscheme?: string | null;
library?: boolean | null;
defaultSuite?: SuiteInstruction[] | null;
defaultSuiteFile?: string | null;
dataExtensions?: string[] | string | null;
}