Skip to content

Commit 84a6427

Browse files
Copilothotlong
andcommitted
fix: add missing ViewDataSchema and validation tests
- Add HttpMethodSchema, HttpRequestSchema, and ViewDataSchema from merged PR - Add validation tests for negative/boundary values in ListColumnSchema.width - Add validation tests for negative/zero/non-integer values in PaginationConfigSchema - Add validation tests for colSpan outside 1-4 range in FormFieldSchema - Fix documentation error in FormSection.mdx: fields type should be (string | object)[] not string | object[] - Fix duplicate type exports - All 257 UI tests passing Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent f0272e6 commit 84a6427

13 files changed

Lines changed: 1220 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: HttpMethod
3+
description: HttpMethod Schema Reference
4+
---
5+
6+
## Allowed Values
7+
8+
* `GET`
9+
* `POST`
10+
* `PUT`
11+
* `PATCH`
12+
* `DELETE`

content/docs/references/ui/view/FormView.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ description: FormView Schema Reference
88
| Property | Type | Required | Description |
99
| :--- | :--- | :--- | :--- |
1010
| **type** | `Enum<'simple' \| 'tabbed' \| 'wizard'>` | optional | |
11+
| **data** | `object \| object \| object` | optional | Data source configuration (defaults to "object" provider) |
1112
| **sections** | `object[]` | optional | |
1213
| **groups** | `object[]` | optional | |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: HttpRequest
3+
description: HttpRequest Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **url** | `string` || API endpoint URL |
11+
| **method** | `Enum<'GET' \| 'POST' \| 'PUT' \| 'PATCH' \| 'DELETE'>` | optional | HTTP method |
12+
| **headers** | `Record<string, string>` | optional | Custom HTTP headers |
13+
| **params** | `Record<string, any>` | optional | Query parameters |
14+
| **body** | `any` | optional | Request body for POST/PUT/PATCH |

content/docs/references/ui/view/ListView.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description: ListView Schema Reference
1010
| **name** | `string` | optional | |
1111
| **label** | `string` | optional | |
1212
| **type** | `Enum<'grid' \| 'kanban' \| 'calendar' \| 'gantt' \| 'map'>` | optional | |
13+
| **data** | `object \| object \| object` | optional | Data source configuration (defaults to "object" provider) |
1314
| **columns** | `string[] \| object[]` || Fields to display as columns |
1415
| **filter** | `any[]` | optional | Filter criteria (JSON Rules) |
1516
| **sort** | `string \| object[]` | optional | |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: ViewData
3+
description: ViewData Schema Reference
4+
---
5+

packages/spec/json-schema/ui/FormView.json

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,143 @@
1313
],
1414
"default": "simple"
1515
},
16+
"data": {
17+
"anyOf": [
18+
{
19+
"type": "object",
20+
"properties": {
21+
"provider": {
22+
"type": "string",
23+
"const": "object"
24+
},
25+
"object": {
26+
"type": "string",
27+
"description": "Target object name"
28+
}
29+
},
30+
"required": [
31+
"provider",
32+
"object"
33+
],
34+
"additionalProperties": false
35+
},
36+
{
37+
"type": "object",
38+
"properties": {
39+
"provider": {
40+
"type": "string",
41+
"const": "api"
42+
},
43+
"read": {
44+
"type": "object",
45+
"properties": {
46+
"url": {
47+
"type": "string",
48+
"description": "API endpoint URL"
49+
},
50+
"method": {
51+
"type": "string",
52+
"enum": [
53+
"GET",
54+
"POST",
55+
"PUT",
56+
"PATCH",
57+
"DELETE"
58+
],
59+
"default": "GET",
60+
"description": "HTTP method"
61+
},
62+
"headers": {
63+
"type": "object",
64+
"additionalProperties": {
65+
"type": "string"
66+
},
67+
"description": "Custom HTTP headers"
68+
},
69+
"params": {
70+
"type": "object",
71+
"additionalProperties": {},
72+
"description": "Query parameters"
73+
},
74+
"body": {
75+
"description": "Request body for POST/PUT/PATCH"
76+
}
77+
},
78+
"required": [
79+
"url"
80+
],
81+
"additionalProperties": false,
82+
"description": "Configuration for fetching data"
83+
},
84+
"write": {
85+
"type": "object",
86+
"properties": {
87+
"url": {
88+
"type": "string",
89+
"description": "API endpoint URL"
90+
},
91+
"method": {
92+
"type": "string",
93+
"enum": [
94+
"GET",
95+
"POST",
96+
"PUT",
97+
"PATCH",
98+
"DELETE"
99+
],
100+
"default": "GET",
101+
"description": "HTTP method"
102+
},
103+
"headers": {
104+
"type": "object",
105+
"additionalProperties": {
106+
"type": "string"
107+
},
108+
"description": "Custom HTTP headers"
109+
},
110+
"params": {
111+
"type": "object",
112+
"additionalProperties": {},
113+
"description": "Query parameters"
114+
},
115+
"body": {
116+
"description": "Request body for POST/PUT/PATCH"
117+
}
118+
},
119+
"required": [
120+
"url"
121+
],
122+
"additionalProperties": false,
123+
"description": "Configuration for submitting data (for forms/editable tables)"
124+
}
125+
},
126+
"required": [
127+
"provider"
128+
],
129+
"additionalProperties": false
130+
},
131+
{
132+
"type": "object",
133+
"properties": {
134+
"provider": {
135+
"type": "string",
136+
"const": "value"
137+
},
138+
"items": {
139+
"type": "array",
140+
"items": {},
141+
"description": "Static data array"
142+
}
143+
},
144+
"required": [
145+
"provider",
146+
"items"
147+
],
148+
"additionalProperties": false
149+
}
150+
],
151+
"description": "Data source configuration (defaults to \"object\" provider)"
152+
},
16153
"sections": {
17154
"type": "array",
18155
"items": {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$ref": "#/definitions/HttpMethod",
3+
"definitions": {
4+
"HttpMethod": {
5+
"type": "string",
6+
"enum": [
7+
"GET",
8+
"POST",
9+
"PUT",
10+
"PATCH",
11+
"DELETE"
12+
]
13+
}
14+
},
15+
"$schema": "http://json-schema.org/draft-07/schema#"
16+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$ref": "#/definitions/HttpRequest",
3+
"definitions": {
4+
"HttpRequest": {
5+
"type": "object",
6+
"properties": {
7+
"url": {
8+
"type": "string",
9+
"description": "API endpoint URL"
10+
},
11+
"method": {
12+
"type": "string",
13+
"enum": [
14+
"GET",
15+
"POST",
16+
"PUT",
17+
"PATCH",
18+
"DELETE"
19+
],
20+
"default": "GET",
21+
"description": "HTTP method"
22+
},
23+
"headers": {
24+
"type": "object",
25+
"additionalProperties": {
26+
"type": "string"
27+
},
28+
"description": "Custom HTTP headers"
29+
},
30+
"params": {
31+
"type": "object",
32+
"additionalProperties": {},
33+
"description": "Query parameters"
34+
},
35+
"body": {
36+
"description": "Request body for POST/PUT/PATCH"
37+
}
38+
},
39+
"required": [
40+
"url"
41+
],
42+
"additionalProperties": false
43+
}
44+
},
45+
"$schema": "http://json-schema.org/draft-07/schema#"
46+
}

0 commit comments

Comments
 (0)