Skip to content

Commit d83a979

Browse files
committed
feat: add JSON schema definitions for page configuration and components
- Introduced `page.schema.json` with detailed definitions for components, actions, data sources, styles, and page configurations. - Implemented `generate-schemas.js` script to automate schema generation from TypeScript types. - Updated VSCode settings for YAML schema validation in basic, enterprise, and express-api starters.
1 parent 506fdd7 commit d83a979

File tree

15 files changed

+2360
-3
lines changed

15 files changed

+2360
-3
lines changed

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"redhat.vscode-yaml"
4+
]
5+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"yaml.schemas": {
3+
"./packages/foundation/types/schemas/object.schema.json": "*.object.yml",
4+
"./packages/foundation/types/schemas/app.schema.json": "*.app.yml",
5+
"./packages/foundation/types/schemas/page.schema.json": "*.page.yml",
6+
"./packages/foundation/types/schemas/menu.schema.json": "*.menu.yml"
7+
}
8+
}

packages/foundation/types/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
"version": "1.6.1",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
6+
"files": [
7+
"dist",
8+
"schemas"
9+
],
610
"scripts": {
7-
"build": "tsc",
11+
"build": "tsc && npm run generate:schemas",
12+
"generate:schemas": "node scripts/generate-schemas.js",
813
"test": "jest --passWithNoTests"
914
},
10-
"dependencies": {}
15+
"devDependencies": {
16+
"ts-json-schema-generator": "^2.4.0"
17+
}
1118
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"$ref": "#/definitions/AppConfig",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"definitions": {
5+
"AppConfig": {
6+
"additionalProperties": {
7+
"description": "Custom metadata/settings"
8+
},
9+
"properties": {
10+
"description": {
11+
"description": "Description of what this application does",
12+
"type": "string"
13+
},
14+
"homepage": {
15+
"description": "Default path to redirect when opening the app",
16+
"type": "string"
17+
},
18+
"icon": {
19+
"description": "Icon name/class for the application",
20+
"type": "string"
21+
},
22+
"is_active": {
23+
"description": "Whether the application is enabled",
24+
"type": "boolean"
25+
},
26+
"label": {
27+
"description": "Display label for the application",
28+
"type": "string"
29+
},
30+
"logo": {
31+
"description": "URL to the application logo",
32+
"type": "string"
33+
},
34+
"name": {
35+
"description": "Unique identifier for the application",
36+
"type": "string"
37+
},
38+
"sort_no": {
39+
"description": "Sort order for display",
40+
"type": "number"
41+
}
42+
},
43+
"required": [
44+
"name",
45+
"label"
46+
],
47+
"type": "object"
48+
}
49+
}
50+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"$ref": "#/definitions/MenuConfig",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"definitions": {
5+
"MenuConfig": {
6+
"additionalProperties": {
7+
"description": "Custom properties"
8+
},
9+
"properties": {
10+
"app": {
11+
"description": "The application this menu belongs to",
12+
"type": "string"
13+
},
14+
"is_active": {
15+
"description": "Whether the menu is active",
16+
"type": "boolean"
17+
},
18+
"items": {
19+
"description": "Menu items",
20+
"items": {
21+
"$ref": "#/definitions/MenuItem"
22+
},
23+
"type": "array"
24+
},
25+
"label": {
26+
"description": "Display label",
27+
"type": "string"
28+
},
29+
"name": {
30+
"description": "Unique identifier for the menu",
31+
"type": "string"
32+
},
33+
"type": {
34+
"$ref": "#/definitions/MenuType",
35+
"description": "Menu type/location"
36+
}
37+
},
38+
"required": [
39+
"name",
40+
"label",
41+
"items"
42+
],
43+
"type": "object"
44+
},
45+
"MenuItem": {
46+
"additionalProperties": {
47+
"description": "Custom properties"
48+
},
49+
"properties": {
50+
"badge": {
51+
"description": "Badge value or expression",
52+
"type": "string"
53+
},
54+
"hidden": {
55+
"description": "Visibility condition",
56+
"type": [
57+
"boolean",
58+
"string"
59+
]
60+
},
61+
"icon": {
62+
"description": "Icon name",
63+
"type": "string"
64+
},
65+
"items": {
66+
"description": "Nested menu items",
67+
"items": {
68+
"$ref": "#/definitions/MenuItem"
69+
},
70+
"type": "array"
71+
},
72+
"label": {
73+
"description": "Display label",
74+
"type": "string"
75+
},
76+
"name": {
77+
"description": "Unique identifier for the menu item",
78+
"type": "string"
79+
},
80+
"object": {
81+
"description": "Associated Object name (for type: object)",
82+
"type": "string"
83+
},
84+
"path": {
85+
"description": "Navigation path (for type: page/url)",
86+
"type": "string"
87+
},
88+
"target": {
89+
"description": "Link target (e.g. _blank)",
90+
"type": "string"
91+
},
92+
"type": {
93+
"$ref": "#/definitions/MenuItemType",
94+
"description": "Item type"
95+
},
96+
"view": {
97+
"description": "Object View name (for type: object)",
98+
"type": "string"
99+
}
100+
},
101+
"required": [
102+
"name",
103+
"label"
104+
],
105+
"type": "object"
106+
},
107+
"MenuItemType": {
108+
"enum": [
109+
"page",
110+
"section",
111+
"url",
112+
"folder",
113+
"object",
114+
"action"
115+
],
116+
"type": "string"
117+
},
118+
"MenuType": {
119+
"enum": [
120+
"sidebar",
121+
"topnav",
122+
"context",
123+
"mobile",
124+
"admin"
125+
],
126+
"type": "string"
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)