1{
2  "title": "JSON schema for forms.json",
3  "$schema": "http://json-schema.org/draft-07/schema#",
4  "type": "object",
5  "additionalProperties": true,
6  "required": [
7    "forms"
8  ],
9  "propertyNames": {
10    "enum": [
11      "forms"
12    ]
13  },
14  "properties": {
15    "forms": {
16      "description": "This tag identifies the embedded card attribute of the capability. This tag is valid only when formsEnabled is set to true. This tag can be left blank by default.",
17      "type": "array",
18      "items": {
19        "type": "object",
20        "uniqueItems": true,
21        "propertyNames": {
22          "enum": [
23            "name",
24            "displayName",
25            "description",
26            "src",
27            "uiSyntax",
28            "isDynamic",
29            "transparencyEnabled",
30            "window",
31            "colorMode",
32            "formConfigAbility",
33            "formVisibleNotify",
34            "isDefault",
35            "updateEnabled",
36            "scheduledUpdateTime",
37            "updateDuration",
38            "defaultDimension",
39            "supportDimensions",
40            "dataProxyEnabled",
41            "metadata",
42            "fontScaleFollowSystem",
43            "supportShapes"
44          ]
45        },
46        "required": [
47          "name",
48          "isDefault",
49          "supportDimensions",
50          "defaultDimension",
51          "updateEnabled"
52        ],
53        "allOf": [
54          {
55            "if": {
56              "properties": {
57                "uiSyntax": {
58                  "const": "hml"
59                }
60              }
61            },
62            "then": {
63              "properties": {
64                "isDynamic": {
65                  "const": true
66                },
67                "transparencyEnabled": {
68                  "const": false
69                }
70              }
71            }
72          }
73        ],
74        "properties": {
75          "name": {
76            "description": "Indicates the name of the form class. The tag value is a string of up to 127 bytes. The tag cannot be default.",
77            "type": "string",
78            "maxLength": 127
79          },
80          "displayName" : {
81            "description": "This tag identifies the display name of the form. The tag value can be a string indicating the display name content (a string of up to 30 bytes). This tag can be left blank by default.",
82            "type": "string",
83            "if": {
84              "pattern": "^[$]string:[0-9a-zA-Z_.]+$"
85            },
86            "else": {
87              "minLength": 1,
88              "maxLength": 30
89            }
90          },
91          "description": {
92            "description": "This tag identifies the description of the form. The tag value can be a string indicating the description content (a string of up to 255 bytes. If the length exceeds 255 bytes, use the resource index mode) or the resource index of the description content to support multiple languages. This tag can be left blank by default.",
93            "type": "string",
94            "minLength": 1,
95            "maxLength": 255
96          },
97          "isDefault": {
98            "description": "Indicates whether the card is the default icon. The value is of the Boolean type. The value true indicates that the card is the default card, and the value false indicates that the card is not the default card. Each capability can have only one default card.",
99            "type": "boolean"
100          },
101          "colorMode": {
102            "description": "This tag identifies the card hue. The value can be auto, dark, or light. dark indicates that the card supports the dark color mode, light indicates that the card does not support the dark color mode, and auto indicates that the card hue is the same as the system hue.",
103            "type": "string",
104            "enum": [
105              "auto",
106              "dark",
107              "light"
108            ],
109            "default": "auto"
110          },
111          "supportDimensions": {
112            "description": "This label identifies the card appearance specification. The value is \"1*2\", \" 2*2\", \"2*4\", \"4*4\", \"1*1\", \"6*4\" and cannot be default. At least one card specification must be specified when defining a card.",
113            "type": "array",
114            "uniqueItems": true,
115            "items": {
116              "type": "string",
117              "enum": [
118                "1*2",
119                "2*2",
120                "2*4",
121                "4*4",
122                "1*1",
123                "6*4"
124              ]
125            }
126          },
127          "defaultDimension": {
128            "description": "This label identifies the default appearance specifications of the card.",
129            "type": "string",
130            "uniqueItems": true,
131            "enum": [
132              "1*2",
133              "2*2",
134              "2*4",
135              "4*4",
136              "1*1",
137              "6*4"
138            ]
139          },
140          "updateEnabled": {
141            "description": "Indicates whether the card supports scheduled refresh. The value is of the Boolean type. true indicates that the card supports scheduled vertical refresh, and false indicates that the card does not support scheduled vertical refresh.",
142            "type": "boolean"
143          },
144          "scheduledUpdateTime": {
145            "description": "Indicates the time when a card is refreshed at a fixed time. The value is counted in 24 hours, accurate to minute. This tag can be set to the default value.",
146            "type": "string",
147            "pattern": "^(([0-1][0-9])|([2][0-3]))[:]+([0-5][0-9])$"
148          },
149          "updateDuration": {
150            "description": "This tag identifies the update frequency of the card. The unit is 30 minutes. The value is a multiple of 30. The maximum frequency of a card is refreshed every 30 minutes. You can select either refresh or refresh at a fixed point. If both are configured, the card is refreshed at a scheduled time. This label is an integer.",
151            "type": "integer",
152            "minimum": 0
153          },
154          "dataProxyEnabled": {
155            "description": "Indicates whether the card supports data proxy refresh. The value is of the Boolean type. true indicates that the card supports data proxy refresh, and false indicates that the card does not support data proxy refresh.",
156            "type": "boolean",
157            "default": false
158          },
159          "metadata": {
160            "description": "Indicates the metadata of the form.",
161            "type": "array",
162            "items": {
163              "type": "object",
164              "propertyNames": {
165                "enum": [
166                  "name",
167                  "value",
168                  "resource"
169                ]
170              },
171              "properties": {
172                "name": {
173                  "description": "Indicates the key of a data element. The value is a string with a maximum of 255 bytes.",
174                  "type": "string",
175                  "maxLength": 255
176                },
177                "value": {
178                  "description": "Indicates the value of a data element. The value is a string with a maximum of 255 bytes.",
179                  "type": "string",
180                  "maxLength": 255
181                },
182                "resource": {
183                  "description": "Indicates the resource of a data element.",
184                  "type": "string",
185                  "pattern": "^[$]profile:[0-9a-zA-Z_.]+|(?=.*[{])(?=.*[}])[0-9a-zA-Z_.{}]+$",
186                  "maxLength": 255
187                }
188              }
189            }
190          },
191          "formConfigAbility": {
192            "description": "Indicates the name of the facility or activity for card adjustment.",
193            "type": "string",
194            "maxLength": 127,
195            "pattern": "^ability://(.*)$"
196          },
197          "formVisibleNotify": {
198            "description": "This tag identifies whether the card is allowed to use card visibility notifications.",
199            "type": "boolean",
200            "default": false
201          },
202          "src": {
203            "description": "Indicates the src of form.",
204            "type": "string"
205          },
206          "uiSyntax": {
207            "description": "This tag identifies the ui syntax.",
208            "type": "string",
209            "default": "hml",
210            "enum": [
211              "hml",
212              "arkts"
213            ]
214          },
215          "isDynamic": {
216            "description": "This tag identifies whether the card is isDynamic.",
217            "type": "boolean",
218            "default": true
219          },
220          "transparencyEnabled": {
221            "description": "This tag identifies whether the form can be set as a transparent background",
222            "type": "boolean",
223            "default": false
224          },
225          "fontScaleFollowSystem": {
226            "description": "This tag identifies whether the form font scale can be set with system config",
227            "type": "boolean",
228            "default": true
229          },
230          "window": {
231            "description": "Defines window-related configurations. This attribute is not supported by devices running the OHOS.",
232            "type": "object",
233            "propertyNames": {
234              "enum": [
235                "designWidth",
236                "autoDesignWidth"
237              ]
238            },
239            "properties": {
240              "designWidth": {
241                "description": "Indicates the baseline width for page design, in pixels. The size of an element is scaled by the actual device width. This label is an integer.",
242                "type": "integer",
243                "minimum": 0
244              },
245              "autoDesignWidth": {
246                "description": "Specifies whether to automatically calculate the baseline width for page design. If it is set to true, the designWidth attribute becomes invalid. The baseline width is calculated based on the device width and screen density.",
247                "type": "boolean"
248              }
249            }
250          },
251          "supportShapes": {
252            "description": "This label identifies the card shape specification. The default value is \"rect\"",
253            "type": "array",
254            "items": {
255              "type": "string",
256              "enum": [
257                "rect",
258                "circle"
259              ]
260            }
261          }
262        }
263      }
264    }
265  }
266}
267