Skip to content

Commit 8a1b523

Browse files
committed
add jsonschema example
1 parent 22760af commit 8a1b523

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

packages/examples/src/examples/jsonschema.ts

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,54 @@ export const schema = {
198198

199199
export const uischema: UISchemaElement = undefined as any as UISchemaElement;
200200

201-
export const data: any = undefined;
201+
export const data = {
202+
type: 'object',
203+
properties: {
204+
name: {
205+
type: 'string',
206+
minLength: 3,
207+
description: 'Please enter your name',
208+
},
209+
vegetarian: {
210+
type: 'boolean',
211+
},
212+
birthDate: {
213+
type: 'string',
214+
format: 'date',
215+
},
216+
nationality: {
217+
type: 'string',
218+
enum: ['DE', 'IT', 'JP', 'US', 'RU', 'Other'],
219+
},
220+
personalData: {
221+
type: 'object',
222+
properties: {
223+
age: {
224+
type: 'integer',
225+
description: 'Please enter your age.',
226+
},
227+
height: {
228+
type: 'number',
229+
},
230+
drivingSkill: {
231+
type: 'number',
232+
maximum: 10,
233+
minimum: 1,
234+
default: 7,
235+
},
236+
},
237+
required: ['age', 'height'],
238+
},
239+
occupation: {
240+
type: 'string',
241+
},
242+
postalCode: {
243+
type: 'string',
244+
maxLength: 5,
245+
},
246+
},
247+
required: ['occupation', 'nationality'],
248+
};
202249

203250
const shouldContainTypeCondition = (type: string[]) => {
204251
return {
@@ -415,10 +462,6 @@ export const uischemas = [
415462
uischema: {
416463
type: 'Control',
417464
scope: '#',
418-
label: 'Form Label',
419-
options: {
420-
vertical: true,
421-
},
422465
},
423466
},
424467
{

0 commit comments

Comments
 (0)