mirror of
https://github.com/github/codeql-action.git
synced 2026-10-30 01:27:22 +00:00
Refactor isVersionInfo with json module
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
export interface VersionInfo {
|
||||
version: string;
|
||||
features?: { [name: string]: boolean };
|
||||
import * as json from "../json";
|
||||
|
||||
/**
|
||||
* The JSON schema of the expected output of the `codeql version` command.
|
||||
*/
|
||||
export const versionInfoBaseSchema = {
|
||||
version: json.string,
|
||||
features: json.optional(json.object({})),
|
||||
/**
|
||||
* The overlay version helps deal with backward incompatible changes for
|
||||
* overlay analysis. When a precompiled query pack reports the same overlay
|
||||
@@ -9,5 +14,21 @@ export interface VersionInfo {
|
||||
* or if either the pack or the CLI does not report an overlay version,
|
||||
* we need to revert to non-overlay analysis.
|
||||
*/
|
||||
overlayVersion?: number;
|
||||
}
|
||||
overlayVersion: json.optional(json.number),
|
||||
} as const satisfies json.Schema;
|
||||
|
||||
/**
|
||||
* The base type that describes the expected output of the `codeql version` command.
|
||||
* This type is partially derived from {@link versionInfoBaseSchema}.
|
||||
*/
|
||||
export type VersionInfoBase = json.FromSchema<typeof versionInfoBaseSchema>;
|
||||
|
||||
/**
|
||||
* The full type that describes the expected output of the `codeql version` command.
|
||||
* This type is partially derived from {@link VersionInfoBase}.
|
||||
*/
|
||||
export type VersionInfo = VersionInfoBase & {
|
||||
// `features` remains optional, but the more specific type takes precedence
|
||||
// over the `any` type derived by `FromSchema`.
|
||||
features?: { [name: string]: boolean };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user