feat: add keycloakify json schema
This commit is contained in:
parent
a84f984a07
commit
4a7dd64982
91
keycloakify-json-schema.json
Normal file
91
keycloakify-json-schema.json
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "https://json.schemastore.org/package.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "keycloakifyPackageJsonSchema"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"$ref": "#/definitions/keycloakifyPackageJsonSchema",
|
||||||
|
"definitions": {
|
||||||
|
"keycloakifyPackageJsonSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"homepage": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"keycloakify": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"extraPages": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extraLoginPages": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extraAccountPages": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extraThemeProperties": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"areAppAndKeycloakServerSharingSameDomain": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"artifactId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"groupId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bundler": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["mvn", "keycloakify", "none"]
|
||||||
|
},
|
||||||
|
"keycloakVersionDefaultAssets": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reactAppBuildDirPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"keycloakifyBuildDirPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customUserAttributes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"themeName": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "version"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
"prepare": "yarn generate-i18n-messages",
|
"prepare": "yarn generate-i18n-messages",
|
||||||
"build": "rimraf dist/ && tsc -p src/bin && tsc -p src/tsconfig.json && tsc-alias -p src/tsconfig.json && yarn grant-exec-perms && yarn copy-files dist/",
|
"build": "rimraf dist/ && tsc -p src/bin && tsc -p src/tsconfig.json && tsc-alias -p src/tsconfig.json && yarn grant-exec-perms && yarn copy-files dist/",
|
||||||
"build:watch": "tsc -p src/tsconfig.json && (concurrently \"tsc -p src/tsconfig.json -w\" \"tsc-alias -p src/tsconfig.json\")",
|
"build:watch": "tsc -p src/tsconfig.json && (concurrently \"tsc -p src/tsconfig.json -w\" \"tsc-alias -p src/tsconfig.json\")",
|
||||||
|
"generate:json-schema": "ts-node scripts/generate-json-schema.ts",
|
||||||
"grant-exec-perms": "node dist/bin/tools/grant-exec-perms.js",
|
"grant-exec-perms": "node dist/bin/tools/grant-exec-perms.js",
|
||||||
"copy-files": "copyfiles -u 1 src/**/*.ftl",
|
"copy-files": "copyfiles -u 1 src/**/*.ftl",
|
||||||
"test": "yarn test:types && vitest run",
|
"test": "yarn test:types && vitest run",
|
||||||
@ -82,7 +83,8 @@
|
|||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsc-alias": "^1.8.3",
|
"tsc-alias": "^1.8.3",
|
||||||
"typescript": "^5.0.1-rc",
|
"typescript": "^5.0.1-rc",
|
||||||
"vitest": "^0.29.8"
|
"vitest": "^0.29.8",
|
||||||
|
"zod-to-json-schema": "^3.20.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/rest": "^18.12.0",
|
"@octokit/rest": "^18.12.0",
|
||||||
|
14
scripts/generate-json-schema.ts
Normal file
14
scripts/generate-json-schema.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
import zodToJsonSchema from "zod-to-json-schema";
|
||||||
|
import { zParsedPackageJson } from "../src/bin/keycloakify/parsedPackageJson";
|
||||||
|
|
||||||
|
const jsonSchemaName = "keycloakifyPackageJsonSchema";
|
||||||
|
const jsonSchema = zodToJsonSchema(zParsedPackageJson, jsonSchemaName);
|
||||||
|
|
||||||
|
const baseProperties = {
|
||||||
|
// merges package.json schema with keycloakify properties
|
||||||
|
"allOf": [{ "$ref": "https://json.schemastore.org/package.json" }, { "$ref": jsonSchemaName }]
|
||||||
|
};
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(process.cwd(), "keycloakify-json-schema.json"), JSON.stringify({ ...baseProperties, ...jsonSchema }, null, 2));
|
@ -28,7 +28,7 @@ export type ParsedPackageJson = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const zParsedPackageJson = z.object({
|
export const zParsedPackageJson = z.object({
|
||||||
"name": z.string(),
|
"name": z.string(),
|
||||||
"version": z.string(),
|
"version": z.string(),
|
||||||
"homepage": z.string().optional(),
|
"homepage": z.string().optional(),
|
||||||
|
@ -3242,6 +3242,11 @@ yocto-queue@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"
|
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"
|
||||||
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==
|
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==
|
||||||
|
|
||||||
|
zod-to-json-schema@^3.20.4:
|
||||||
|
version "3.20.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.20.4.tgz#155f687c5a059fdc0f1bb3ff32d6e9200036b6f4"
|
||||||
|
integrity sha512-Un9+kInJ2Zt63n6Z7mLqBifzzPcOyX+b+Exuzf7L1+xqck9Q2EPByyTRduV3kmSPaXaRer1JCsucubpgL1fipg==
|
||||||
|
|
||||||
zod@^3.17.10:
|
zod@^3.17.10:
|
||||||
version "3.21.4"
|
version "3.21.4"
|
||||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db"
|
resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user