Skip to content

Commit ec76b5d

Browse files
authored
feat: expand common schema types with accessibility, dynamic evaluati… (#100)
feat: add missing common schema types Appends the missing types (AccessibilityAttributes, ComponentCommon, DynamicStringList, CheckRule, Checkable) to the A2UI common schema types definitions without modifying the existing types.
1 parent 7f4f14f commit ec76b5d

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

shell/src/app/gallery/schema/common-types-schema.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,92 @@ export const COMMON_TYPES_SCHEMA: Record<string, unknown> = {
167167
},
168168
],
169169
},
170+
AccessibilityAttributes: {
171+
type: 'object',
172+
description:
173+
'Attributes to enhance accessibility when using assistive technologies like screen readers.',
174+
properties: {
175+
label: {
176+
$ref: '#/$defs/DynamicString',
177+
description:
178+
"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'.",
179+
},
180+
description: {
181+
$ref: '#/$defs/DynamicString',
182+
description:
183+
"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'.",
184+
},
185+
},
186+
},
187+
ComponentCommon: {
188+
type: 'object',
189+
properties: {
190+
id: {
191+
$ref: '#/$defs/ComponentId',
192+
},
193+
accessibility: {
194+
$ref: '#/$defs/AccessibilityAttributes',
195+
},
196+
},
197+
required: ['id'],
198+
},
199+
DynamicStringList: {
200+
description:
201+
'Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.',
202+
oneOf: [
203+
{
204+
type: 'array',
205+
items: {
206+
type: 'string',
207+
},
208+
},
209+
{
210+
$ref: '#/$defs/DataBinding',
211+
},
212+
{
213+
allOf: [
214+
{
215+
$ref: '#/$defs/FunctionCall',
216+
},
217+
{
218+
properties: {
219+
returnType: {
220+
const: 'array',
221+
},
222+
},
223+
},
224+
],
225+
},
226+
],
227+
},
228+
CheckRule: {
229+
type: 'object',
230+
description: 'A single validation rule applied to an input component.',
231+
properties: {
232+
condition: {
233+
$ref: '#/$defs/DynamicBoolean',
234+
},
235+
message: {
236+
type: 'string',
237+
description: 'The error message to display if the check fails.',
238+
},
239+
},
240+
required: ['condition', 'message'],
241+
additionalProperties: false,
242+
},
243+
Checkable: {
244+
description: 'Properties for components that support client-side checks.',
245+
type: 'object',
246+
properties: {
247+
checks: {
248+
type: 'array',
249+
description:
250+
'A list of checks to perform. These are function calls that must return a boolean indicating validity.',
251+
items: {
252+
$ref: '#/$defs/CheckRule',
253+
},
254+
},
255+
},
256+
},
170257
},
171258
};

0 commit comments

Comments
 (0)