Skip to content

Commit b92b5a8

Browse files
committed
Add additional oneOf examples (recursive one, one for issue 1253)
1 parent 84343ea commit b92b5a8

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

packages/examples/src/1253.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { registerExamples } from './register';
2+
3+
export const schema = {
4+
type: 'object',
5+
properties: {
6+
value: {
7+
oneOf: [
8+
{
9+
title: 'String',
10+
type: 'string'
11+
},
12+
{
13+
title: 'Number',
14+
type: 'number'
15+
}
16+
]
17+
}
18+
}
19+
};
20+
21+
export const uischema = {
22+
type: 'Control',
23+
label: 'Value',
24+
scope: '#/properties/value'
25+
};
26+
27+
const data = {};
28+
29+
registerExamples([
30+
{
31+
name: 'issue-1253',
32+
label: 'issue 1253 (oneOf)',
33+
data,
34+
schema,
35+
uischema
36+
}
37+
]);

packages/examples/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ import * as object from './object';
5555
import * as i18n from './i18n';
5656
import * as issue_1169 from './1169';
5757
import * as issue_1220 from './1220';
58+
import * as issue_1253 from './1253';
59+
import * as oneOfRecursive from './oneOf-recursive';
5860
export * from './register';
5961
export * from './example';
62+
6063
export {
6164
allOf,
6265
anyOf,
@@ -90,5 +93,7 @@ export {
9093
object,
9194
i18n,
9295
issue_1169,
93-
issue_1220
96+
issue_1220,
97+
issue_1253,
98+
oneOfRecursive
9499
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { registerExamples } from './register';
2+
3+
export const schema = {
4+
$schema: 'http://json-schema.org/draft-07/schema#',
5+
definitions: {
6+
fileOrFolder: {
7+
title: 'fileOrFolder',
8+
oneOf: [{ $ref: '#/definitions/file' }, { $ref: '#/definitions/folder' }]
9+
},
10+
file: {
11+
title: 'File',
12+
type: 'object',
13+
properties: {
14+
name: { type: 'string' }
15+
}
16+
},
17+
folder: {
18+
type: 'object',
19+
title: 'Folder',
20+
properties: {
21+
name: { type: 'string' },
22+
children: {
23+
type: 'array',
24+
items: {
25+
$ref: '#/definitions/fileOrFolder'
26+
}
27+
}
28+
}
29+
}
30+
},
31+
type: 'object',
32+
properties: {
33+
root: {
34+
type: 'array',
35+
items: {
36+
$ref: '#/definitions/folder'
37+
}
38+
}
39+
}
40+
};
41+
42+
export const uischema = {
43+
type: 'Control',
44+
scope: '#'
45+
};
46+
47+
const data = {};
48+
49+
registerExamples([
50+
{
51+
name: 'oneOf-recursive',
52+
label: 'oneOf recursive',
53+
data,
54+
schema,
55+
uischema
56+
}
57+
]);

packages/examples/src/oneOfIssues.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)