shinkansen-transmission 2.2.235 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.cjs +1 -0
- package/eslint.config.mjs +28 -30
- package/index.d.mts +321 -16
- package/package.json +6 -6
- package/src/index.cjs +2 -0
- package/src/index.d.mts +10 -9
- package/src/transmission/common/index.d.mts +153 -87
- package/src/transmission/common/index.mjs +670 -175
- package/src/transmission/from-document-to-hash/array/index.mjs +20 -4
- package/src/transmission/from-document-to-hash/boolean/index.mjs +25 -9
- package/src/transmission/from-document-to-hash/index.d.mts +8 -19
- package/src/transmission/from-document-to-hash/index.mjs +102 -16
- package/src/transmission/from-document-to-hash/null/index.mjs +25 -9
- package/src/transmission/from-document-to-hash/number/index.mjs +25 -9
- package/src/transmission/from-document-to-hash/object/index.mjs +22 -6
- package/src/transmission/from-document-to-hash/string/index.mjs +25 -9
- package/src/transmission/from-hash-to-document/array/index.mjs +22 -5
- package/src/transmission/from-hash-to-document/boolean/index.mjs +21 -4
- package/src/transmission/from-hash-to-document/index.d.mts +24 -26
- package/src/transmission/from-hash-to-document/index.mjs +264 -142
- package/src/transmission/from-hash-to-document/null/index.mjs +21 -4
- package/src/transmission/from-hash-to-document/number/index.mjs +21 -4
- package/src/transmission/from-hash-to-document/object/index.mjs +22 -5
- package/src/transmission/from-hash-to-document/string/index.mjs +26 -4
- package/src/transmission/index.d.mts +4 -10
- package/src/transmission/to-zashiki/index.d.mts +5 -13
- package/src/transmission/to-zashiki/params/index.mjs +430 -0
- package/src/transmission/to-zashiki/render/array/index.mjs +737 -0
- package/src/transmission/to-zashiki/render/boolean/index.mjs +794 -0
- package/src/transmission/to-zashiki/render/index.mjs +157 -0
- package/src/transmission/to-zashiki/render/null/index.mjs +796 -0
- package/src/transmission/to-zashiki/render/number/index.mjs +940 -0
- package/src/transmission/to-zashiki/render/object/index.mjs +653 -0
- package/src/transmission/to-zashiki/render/string/index.mjs +910 -0
- package/src/transmission/to-zashiki/render-params/root-schema/index.mjs +212 -0
- package/src/transmission/to-zashiki/render-params/schema/index.mjs +731 -0
- package/src/transmission/to-zashiki/transform-root-schema.mjs +485 -421
- package/src/transmission/to-zashiki/transform-schema.mjs +1988 -4663
@@ -0,0 +1,653 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {TransmissionTypes.ObjectLiteralType} ObjectLiteralType
|
3
|
+
* @typedef {TransmissionTypes.ObjectType} ObjectType
|
4
|
+
*
|
5
|
+
* @typedef {TransmissionTypes.EnumType} EnumType
|
6
|
+
* @typedef {TransmissionTypes.AnyOfType} AnyOfType
|
7
|
+
* @typedef {TransmissionTypes.OneOfType} OneOfType
|
8
|
+
* @typedef {TransmissionTypes.FieldType} FieldType
|
9
|
+
*
|
10
|
+
* @typedef {TransmissionTypes.SchemaType} SchemaType
|
11
|
+
* @typedef {TransmissionTypes.ValuesType} ValuesType
|
12
|
+
* @typedef {TransmissionTypes.ParamsType} ParamsType
|
13
|
+
*
|
14
|
+
* @typedef {TransmissionTypes.Zashiki.ZashikiType} ZashikiType
|
15
|
+
*
|
16
|
+
* @typedef {TransmissionTypes.Zashiki.StringMetaType} ZashikiStringMetaType
|
17
|
+
* @typedef {TransmissionTypes.Zashiki.NumberMetaType} ZashikiNumberMetaType
|
18
|
+
* @typedef {TransmissionTypes.Zashiki.ArrayMetaType} ZashikiArrayMetaType
|
19
|
+
* @typedef {TransmissionTypes.Zashiki.ObjectMetaType} ZashikiObjectMetaType
|
20
|
+
* @typedef {TransmissionTypes.Zashiki.BooleanMetaType} ZashikiBooleanMetaType
|
21
|
+
* @typedef {TransmissionTypes.Zashiki.NullMetaType} ZashikiNullMetaType
|
22
|
+
*
|
23
|
+
* @typedef {TransmissionTypes.Zashiki.StringElementsType} ZashikiStringElementsType
|
24
|
+
* @typedef {TransmissionTypes.Zashiki.NumberElementsType} ZashikiNumberElementsType
|
25
|
+
* @typedef {TransmissionTypes.Zashiki.ArrayElementsType} ZashikiArrayElementsType
|
26
|
+
* @typedef {TransmissionTypes.Zashiki.ObjectElementsType} ZashikiObjectElementsType
|
27
|
+
* @typedef {TransmissionTypes.Zashiki.BooleanElementsType} ZashikiBooleanElementsType
|
28
|
+
* @typedef {TransmissionTypes.Zashiki.NullElementsType} ZashikiNullElementsType
|
29
|
+
*/
|
30
|
+
|
31
|
+
import debug from 'debug'
|
32
|
+
|
33
|
+
import {
|
34
|
+
getTitle,
|
35
|
+
getDescription,
|
36
|
+
isParentUri,
|
37
|
+
getMinProperties,
|
38
|
+
getMaxProperties,
|
39
|
+
getMetaProps,
|
40
|
+
getElementsFieldPropsForEnum,
|
41
|
+
getElementsFieldPropsForAnyOf,
|
42
|
+
getElementsFieldPropsForOneOf,
|
43
|
+
getElementsFieldPropsForAllOf
|
44
|
+
} from '#transmission/transmission/common'
|
45
|
+
|
46
|
+
const log = debug('shinkansen-transmission/to-zashiki/render/object')
|
47
|
+
|
48
|
+
log('`shinkansen` is awake')
|
49
|
+
|
50
|
+
/**
|
51
|
+
* @param {ParamsType} params
|
52
|
+
* @param {string} uri
|
53
|
+
* @param {{ minProperties?: number }} minProperties
|
54
|
+
* @param {{ maxProperties?: number }} maxProperties
|
55
|
+
* @returns {ZashikiObjectMetaType}
|
56
|
+
*/
|
57
|
+
export function renderObjectMetaForEnum (params, uri, minProperties, maxProperties) {
|
58
|
+
/**
|
59
|
+
* log('renderObjectMetaForEnum')
|
60
|
+
*/
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @type {{ parentUri?: string }}
|
64
|
+
*/
|
65
|
+
const {
|
66
|
+
parentUri = '#',
|
67
|
+
...metaProps
|
68
|
+
} = getMetaProps(params, uri)
|
69
|
+
|
70
|
+
return (
|
71
|
+
Object.assign(
|
72
|
+
{
|
73
|
+
uri,
|
74
|
+
type: 'object'
|
75
|
+
},
|
76
|
+
isParentUri(parentUri, uri) ? { parentUri } : {},
|
77
|
+
minProperties,
|
78
|
+
maxProperties,
|
79
|
+
metaProps
|
80
|
+
)
|
81
|
+
)
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @param {ParamsType} params
|
86
|
+
* @param {string} uri
|
87
|
+
* @param {{ minProperties?: number }} minProperties
|
88
|
+
* @param {{ maxProperties?: number }} maxProperties
|
89
|
+
* @returns {ZashikiObjectMetaType}
|
90
|
+
*/
|
91
|
+
export function renderObjectMetaForAnyOf (params, uri, minProperties, maxProperties) {
|
92
|
+
/**
|
93
|
+
* log('renderObjectMetaForAnyOf')
|
94
|
+
*/
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @type {{ parentUri?: string }}
|
98
|
+
*/
|
99
|
+
const {
|
100
|
+
parentUri = '#',
|
101
|
+
...metaProps
|
102
|
+
} = getMetaProps(params, uri)
|
103
|
+
|
104
|
+
return (
|
105
|
+
Object.assign(
|
106
|
+
{
|
107
|
+
uri,
|
108
|
+
type: 'object'
|
109
|
+
},
|
110
|
+
isParentUri(parentUri, uri) ? { parentUri } : {},
|
111
|
+
minProperties,
|
112
|
+
maxProperties,
|
113
|
+
metaProps
|
114
|
+
)
|
115
|
+
)
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @param {ParamsType} params
|
120
|
+
* @param {string} uri
|
121
|
+
* @param {{ minProperties?: number }} minProperties
|
122
|
+
* @param {{ maxProperties?: number }} maxProperties
|
123
|
+
* @returns {ZashikiObjectMetaType}
|
124
|
+
*/
|
125
|
+
export function renderObjectMetaForOneOf (params, uri, minProperties, maxProperties) {
|
126
|
+
/**
|
127
|
+
* log('renderObjectMetaForOneOf')
|
128
|
+
*/
|
129
|
+
|
130
|
+
/**
|
131
|
+
* @type {{ parentUri?: string }}
|
132
|
+
*/
|
133
|
+
const {
|
134
|
+
parentUri = '#',
|
135
|
+
...metaProps
|
136
|
+
} = getMetaProps(params, uri)
|
137
|
+
|
138
|
+
return (
|
139
|
+
Object.assign(
|
140
|
+
{
|
141
|
+
uri,
|
142
|
+
type: 'object'
|
143
|
+
},
|
144
|
+
isParentUri(parentUri, uri) ? { parentUri } : {},
|
145
|
+
minProperties,
|
146
|
+
maxProperties,
|
147
|
+
metaProps
|
148
|
+
)
|
149
|
+
)
|
150
|
+
}
|
151
|
+
|
152
|
+
/**
|
153
|
+
* @param {ParamsType} params
|
154
|
+
* @param {string} uri
|
155
|
+
* @param {{ minProperties?: number }} minProperties
|
156
|
+
* @param {{ maxProperties?: number }} maxProperties
|
157
|
+
* @returns {ZashikiObjectMetaType}
|
158
|
+
*/
|
159
|
+
export function renderObjectMetaForAllOf (params, uri, minProperties, maxProperties) {
|
160
|
+
/**
|
161
|
+
* log('renderObjectMetaForAllOf')
|
162
|
+
*/
|
163
|
+
|
164
|
+
/**
|
165
|
+
* @type {{ parentUri?: string }}
|
166
|
+
*/
|
167
|
+
const {
|
168
|
+
parentUri = '#',
|
169
|
+
...metaProps
|
170
|
+
} = getMetaProps(params, uri)
|
171
|
+
|
172
|
+
return (
|
173
|
+
Object.assign(
|
174
|
+
{
|
175
|
+
uri,
|
176
|
+
type: 'object'
|
177
|
+
},
|
178
|
+
isParentUri(parentUri, uri) ? { parentUri } : {},
|
179
|
+
minProperties,
|
180
|
+
maxProperties,
|
181
|
+
metaProps
|
182
|
+
)
|
183
|
+
)
|
184
|
+
}
|
185
|
+
|
186
|
+
/**
|
187
|
+
* @param {ParamsType} params
|
188
|
+
* @param {string} uri
|
189
|
+
* @param {{ minProperties?: number }} minProperties
|
190
|
+
* @param {{ maxProperties?: number }} maxProperties
|
191
|
+
* @returns {ZashikiObjectMetaType}
|
192
|
+
*/
|
193
|
+
export function renderObjectMeta (params, uri, minProperties, maxProperties) {
|
194
|
+
/**
|
195
|
+
* log('renderObjectMeta')
|
196
|
+
*/
|
197
|
+
|
198
|
+
/**
|
199
|
+
* @type {{ parentUri?: string }}
|
200
|
+
*/
|
201
|
+
const {
|
202
|
+
parentUri = '#',
|
203
|
+
...metaProps
|
204
|
+
} = getMetaProps(params, uri)
|
205
|
+
|
206
|
+
return (
|
207
|
+
Object.assign(
|
208
|
+
{
|
209
|
+
uri,
|
210
|
+
type: 'object'
|
211
|
+
},
|
212
|
+
isParentUri(parentUri, uri) ? { parentUri } : {},
|
213
|
+
minProperties,
|
214
|
+
maxProperties,
|
215
|
+
metaProps
|
216
|
+
)
|
217
|
+
)
|
218
|
+
}
|
219
|
+
|
220
|
+
/**
|
221
|
+
* @param {ObjectLiteralType | ObjectType} field
|
222
|
+
* @param {ParamsType} params
|
223
|
+
* @param {string} uri
|
224
|
+
* @param {{ minProperties?: number }} minProperties
|
225
|
+
* @param {{ maxProperties?: number }} maxProperties
|
226
|
+
* @returns {EnumType}
|
227
|
+
*/
|
228
|
+
export function renderObjectElementsFieldForEnum (field, params, uri, minProperties, maxProperties) {
|
229
|
+
/**
|
230
|
+
* log('renderObjectElementsFieldForEnum')
|
231
|
+
*/
|
232
|
+
|
233
|
+
const fieldProps = getElementsFieldPropsForEnum(params, uri)
|
234
|
+
|
235
|
+
return (
|
236
|
+
Object.assign(
|
237
|
+
field,
|
238
|
+
minProperties,
|
239
|
+
maxProperties,
|
240
|
+
fieldProps,
|
241
|
+
{
|
242
|
+
id: uri
|
243
|
+
}
|
244
|
+
)
|
245
|
+
)
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* @param {ObjectLiteralType | ObjectType} field
|
250
|
+
* @param {ParamsType} params
|
251
|
+
* @param {string} uri
|
252
|
+
* @param {{ minProperties?: number }} minProperties
|
253
|
+
* @param {{ maxProperties?: number }} maxProperties
|
254
|
+
* @returns {AnyOfType}
|
255
|
+
*/
|
256
|
+
export function renderObjectElementsFieldForAnyOf (field, params, uri, minProperties, maxProperties) {
|
257
|
+
/**
|
258
|
+
* log('renderObjectElementsFieldForAnyOf')
|
259
|
+
*/
|
260
|
+
|
261
|
+
const fieldProps = getElementsFieldPropsForAnyOf(params, uri)
|
262
|
+
|
263
|
+
return (
|
264
|
+
Object.assign(
|
265
|
+
field,
|
266
|
+
minProperties,
|
267
|
+
maxProperties,
|
268
|
+
fieldProps,
|
269
|
+
{
|
270
|
+
id: uri
|
271
|
+
}
|
272
|
+
)
|
273
|
+
)
|
274
|
+
}
|
275
|
+
|
276
|
+
/**
|
277
|
+
* @param {ObjectLiteralType | ObjectType} field
|
278
|
+
* @param {ParamsType} params
|
279
|
+
* @param {string} uri
|
280
|
+
* @param {{ minProperties?: number }} minProperties
|
281
|
+
* @param {{ maxProperties?: number }} maxProperties
|
282
|
+
* @returns {OneOfType}
|
283
|
+
*/
|
284
|
+
export function renderObjectElementsFieldForOneOf (field, params, uri, minProperties, maxProperties) {
|
285
|
+
/**
|
286
|
+
* log('renderObjectElementsFieldForOneOf')
|
287
|
+
*/
|
288
|
+
|
289
|
+
const fieldProps = getElementsFieldPropsForOneOf(params, uri)
|
290
|
+
|
291
|
+
return (
|
292
|
+
Object.assign(
|
293
|
+
field,
|
294
|
+
minProperties,
|
295
|
+
maxProperties,
|
296
|
+
fieldProps,
|
297
|
+
{
|
298
|
+
id: uri
|
299
|
+
}
|
300
|
+
)
|
301
|
+
)
|
302
|
+
}
|
303
|
+
|
304
|
+
/**
|
305
|
+
* @param {ObjectLiteralType | ObjectType} field
|
306
|
+
* @param {ParamsType} params
|
307
|
+
* @param {string} uri
|
308
|
+
* @param {{ minProperties?: number }} minProperties
|
309
|
+
* @param {{ maxProperties?: number }} maxProperties
|
310
|
+
* @returns {FieldType}
|
311
|
+
*/
|
312
|
+
export function renderObjectElementsFieldForAllOf (field, params, uri, minProperties, maxProperties) {
|
313
|
+
/**
|
314
|
+
* log('renderObjectElementsFieldForAllOf')
|
315
|
+
*/
|
316
|
+
|
317
|
+
const fieldProps = getElementsFieldPropsForAllOf(params, uri)
|
318
|
+
|
319
|
+
return (
|
320
|
+
Object.assign(
|
321
|
+
field,
|
322
|
+
minProperties,
|
323
|
+
maxProperties,
|
324
|
+
fieldProps,
|
325
|
+
{
|
326
|
+
id: uri
|
327
|
+
}
|
328
|
+
)
|
329
|
+
)
|
330
|
+
}
|
331
|
+
|
332
|
+
/**
|
333
|
+
* @param {ObjectLiteralType | ObjectType} elements
|
334
|
+
* @param {SchemaType} schema
|
335
|
+
* @returns {ObjectLiteralType | ObjectType}
|
336
|
+
*/
|
337
|
+
export function getObjectElements (elements, schema) {
|
338
|
+
/**
|
339
|
+
* log('getObjectElements')
|
340
|
+
*/
|
341
|
+
|
342
|
+
return (
|
343
|
+
Object.assign(
|
344
|
+
elements,
|
345
|
+
getTitle(schema),
|
346
|
+
getDescription(schema)
|
347
|
+
)
|
348
|
+
)
|
349
|
+
}
|
350
|
+
|
351
|
+
/**
|
352
|
+
* @param {SchemaType} schema
|
353
|
+
* @param {ParamsType} params
|
354
|
+
* @param {string} uri
|
355
|
+
* @param {{ minProperties?: number }} minProperties
|
356
|
+
* @param {{ maxProperties?: number }} maxProperties
|
357
|
+
* @returns {ZashikiObjectElementsType}
|
358
|
+
*/
|
359
|
+
export function renderObjectElementsForEnum (schema, params, uri, minProperties, maxProperties) {
|
360
|
+
/**
|
361
|
+
* log('renderObjectElementsForEnum')
|
362
|
+
*/
|
363
|
+
|
364
|
+
/**
|
365
|
+
* @type {ObjectLiteralType}
|
366
|
+
*/
|
367
|
+
const elements = {}
|
368
|
+
|
369
|
+
/**
|
370
|
+
* @type {ObjectLiteralType}
|
371
|
+
*/
|
372
|
+
const field = {}
|
373
|
+
|
374
|
+
return (
|
375
|
+
Object.assign(
|
376
|
+
getObjectElements(elements, schema),
|
377
|
+
{
|
378
|
+
enum: renderObjectElementsFieldForEnum(field, params, uri, minProperties, maxProperties)
|
379
|
+
}
|
380
|
+
)
|
381
|
+
)
|
382
|
+
}
|
383
|
+
|
384
|
+
/**
|
385
|
+
* @param {SchemaType} schema
|
386
|
+
* @param {ParamsType} params
|
387
|
+
* @param {string} uri
|
388
|
+
* @param {{ minProperties?: number }} minProperties
|
389
|
+
* @param {{ maxProperties?: number }} maxProperties
|
390
|
+
* @returns {ZashikiObjectElementsType}
|
391
|
+
*/
|
392
|
+
export function renderObjectElementsForAnyOf (schema, params, uri, minProperties, maxProperties) {
|
393
|
+
/**
|
394
|
+
* log('renderObjectElementsForAnyOf')
|
395
|
+
*/
|
396
|
+
|
397
|
+
/**
|
398
|
+
* @type {ObjectLiteralType}
|
399
|
+
*/
|
400
|
+
const elements = {}
|
401
|
+
|
402
|
+
/**
|
403
|
+
* @type {ObjectLiteralType}
|
404
|
+
*/
|
405
|
+
const field = {}
|
406
|
+
|
407
|
+
return (
|
408
|
+
Object.assign(
|
409
|
+
getObjectElements(elements, schema),
|
410
|
+
{
|
411
|
+
anyOf: renderObjectElementsFieldForAnyOf(field, params, uri, minProperties, maxProperties)
|
412
|
+
}
|
413
|
+
)
|
414
|
+
)
|
415
|
+
}
|
416
|
+
|
417
|
+
/**
|
418
|
+
* @param {SchemaType} schema
|
419
|
+
* @param {ParamsType} params
|
420
|
+
* @param {string} uri
|
421
|
+
* @param {{ minProperties?: number }} minProperties
|
422
|
+
* @param {{ maxProperties?: number }} maxProperties
|
423
|
+
* @returns {ZashikiObjectElementsType}
|
424
|
+
*/
|
425
|
+
export function renderObjectElementsForOneOf (schema, params, uri, minProperties, maxProperties) {
|
426
|
+
/**
|
427
|
+
* log('renderObjectElementsForOneOf')
|
428
|
+
*/
|
429
|
+
|
430
|
+
/**
|
431
|
+
* @type {ObjectLiteralType}
|
432
|
+
*/
|
433
|
+
const elements = {}
|
434
|
+
|
435
|
+
/**
|
436
|
+
* @type {ObjectLiteralType}
|
437
|
+
*/
|
438
|
+
const field = {}
|
439
|
+
|
440
|
+
return (
|
441
|
+
Object.assign(
|
442
|
+
getObjectElements(elements, schema),
|
443
|
+
{
|
444
|
+
oneOf: renderObjectElementsFieldForOneOf(field, params, uri, minProperties, maxProperties)
|
445
|
+
}
|
446
|
+
)
|
447
|
+
)
|
448
|
+
}
|
449
|
+
|
450
|
+
/**
|
451
|
+
* @param {SchemaType} schema
|
452
|
+
* @param {ParamsType} params
|
453
|
+
* @param {string} uri
|
454
|
+
* @param {{ minProperties?: number }} minProperties
|
455
|
+
* @param {{ maxProperties?: number }} maxProperties
|
456
|
+
* @returns {ZashikiObjectElementsType}
|
457
|
+
*/
|
458
|
+
export function renderObjectElementsForAllOf (schema, params, uri, minProperties, maxProperties) {
|
459
|
+
/**
|
460
|
+
* log('renderObjectElementsForAllOf')
|
461
|
+
*/
|
462
|
+
|
463
|
+
/**
|
464
|
+
* @type {ObjectLiteralType}
|
465
|
+
*/
|
466
|
+
const elements = {}
|
467
|
+
|
468
|
+
/**
|
469
|
+
* @type {ObjectLiteralType}
|
470
|
+
*/
|
471
|
+
const field = {}
|
472
|
+
|
473
|
+
return (
|
474
|
+
Object.assign(
|
475
|
+
getObjectElements(elements, schema),
|
476
|
+
{
|
477
|
+
field: renderObjectElementsFieldForAllOf(field, params, uri, minProperties, maxProperties)
|
478
|
+
}
|
479
|
+
)
|
480
|
+
)
|
481
|
+
}
|
482
|
+
|
483
|
+
/**
|
484
|
+
* @param {SchemaType} schema
|
485
|
+
* @param {ParamsType} params
|
486
|
+
* @returns {ZashikiObjectElementsType}
|
487
|
+
*/
|
488
|
+
export function renderObjectElements (schema, params) {
|
489
|
+
/**
|
490
|
+
* log('renderObjectElements')
|
491
|
+
*/
|
492
|
+
|
493
|
+
/**
|
494
|
+
* @type {ObjectLiteralType}
|
495
|
+
*/
|
496
|
+
const elements = {}
|
497
|
+
|
498
|
+
const {
|
499
|
+
fields = []
|
500
|
+
} = params
|
501
|
+
|
502
|
+
return (
|
503
|
+
Object.assign(
|
504
|
+
getObjectElements(elements, schema),
|
505
|
+
{
|
506
|
+
fields
|
507
|
+
}
|
508
|
+
)
|
509
|
+
)
|
510
|
+
}
|
511
|
+
|
512
|
+
/**
|
513
|
+
* "enum"
|
514
|
+
*
|
515
|
+
* @param {SchemaType} schema
|
516
|
+
* @param {ValuesType} values
|
517
|
+
* @param {ParamsType} params
|
518
|
+
* @returns {ZashikiType}
|
519
|
+
*/
|
520
|
+
export function renderObjectForEnum (schema, values, params) {
|
521
|
+
/**
|
522
|
+
* log('renderObjectForEnum')
|
523
|
+
*/
|
524
|
+
|
525
|
+
const {
|
526
|
+
uri = '#/'
|
527
|
+
} = params
|
528
|
+
|
529
|
+
const minProperties = getMinProperties(schema)
|
530
|
+
const maxProperties = getMaxProperties(schema)
|
531
|
+
|
532
|
+
const meta = renderObjectMetaForEnum(params, uri, minProperties, maxProperties)
|
533
|
+
const elements = renderObjectElementsForEnum(schema, params, uri, minProperties, maxProperties)
|
534
|
+
|
535
|
+
return {
|
536
|
+
meta,
|
537
|
+
elements
|
538
|
+
}
|
539
|
+
}
|
540
|
+
|
541
|
+
/**
|
542
|
+
* "anyOf"
|
543
|
+
*
|
544
|
+
* @param {SchemaType} schema
|
545
|
+
* @param {ValuesType} values
|
546
|
+
* @param {ParamsType} params
|
547
|
+
* @returns {ZashikiType}
|
548
|
+
*/
|
549
|
+
export function renderObjectForAnyOf (schema, values, params) {
|
550
|
+
/**
|
551
|
+
* log('renderObjectForAnyOf')
|
552
|
+
*/
|
553
|
+
|
554
|
+
const {
|
555
|
+
uri = '#/'
|
556
|
+
} = params
|
557
|
+
|
558
|
+
const minProperties = getMinProperties(schema)
|
559
|
+
const maxProperties = getMaxProperties(schema)
|
560
|
+
|
561
|
+
const meta = renderObjectMetaForAnyOf(params, uri, minProperties, maxProperties)
|
562
|
+
const elements = renderObjectElementsForAnyOf(schema, params, uri, minProperties, maxProperties)
|
563
|
+
|
564
|
+
return {
|
565
|
+
meta,
|
566
|
+
elements
|
567
|
+
}
|
568
|
+
}
|
569
|
+
|
570
|
+
/**
|
571
|
+
* "oneOf"
|
572
|
+
*
|
573
|
+
* @param {SchemaType} schema
|
574
|
+
* @param {ValuesType} values
|
575
|
+
* @param {ParamsType} params
|
576
|
+
* @returns {ZashikiType}
|
577
|
+
*/
|
578
|
+
export function renderObjectForOneOf (schema, values, params) {
|
579
|
+
/**
|
580
|
+
* log('renderObjectForOneOf')
|
581
|
+
*/
|
582
|
+
|
583
|
+
const {
|
584
|
+
uri = '#/'
|
585
|
+
} = params
|
586
|
+
|
587
|
+
const minProperties = getMinProperties(schema)
|
588
|
+
const maxProperties = getMaxProperties(schema)
|
589
|
+
|
590
|
+
const meta = renderObjectMetaForOneOf(params, uri, minProperties, maxProperties)
|
591
|
+
const elements = renderObjectElementsForOneOf(schema, params, uri, minProperties, maxProperties)
|
592
|
+
|
593
|
+
return {
|
594
|
+
meta,
|
595
|
+
elements
|
596
|
+
}
|
597
|
+
}
|
598
|
+
|
599
|
+
/**
|
600
|
+
* "allOf"
|
601
|
+
*
|
602
|
+
* @param {SchemaType} schema
|
603
|
+
* @param {ValuesType} values
|
604
|
+
* @param {ParamsType} params
|
605
|
+
* @returns {ZashikiType}
|
606
|
+
*/
|
607
|
+
export function renderObjectForAllOf (schema, values, params) {
|
608
|
+
/**
|
609
|
+
* log('renderObjectForAllOf')
|
610
|
+
*/
|
611
|
+
|
612
|
+
const {
|
613
|
+
uri = '#/'
|
614
|
+
} = params
|
615
|
+
|
616
|
+
const minProperties = getMinProperties(schema)
|
617
|
+
const maxProperties = getMaxProperties(schema)
|
618
|
+
|
619
|
+
const meta = renderObjectMetaForAllOf(params, uri, minProperties, maxProperties)
|
620
|
+
const elements = renderObjectElementsForAllOf(schema, params, uri, minProperties, maxProperties)
|
621
|
+
|
622
|
+
return {
|
623
|
+
meta,
|
624
|
+
elements
|
625
|
+
}
|
626
|
+
}
|
627
|
+
|
628
|
+
/**
|
629
|
+
* @param {SchemaType} schema
|
630
|
+
* @param {ValuesType} values
|
631
|
+
* @param {ParamsType} params
|
632
|
+
* @returns {ZashikiType}
|
633
|
+
*/
|
634
|
+
export function renderObject (schema, values, params) {
|
635
|
+
/**
|
636
|
+
* log('renderObject')
|
637
|
+
*/
|
638
|
+
|
639
|
+
const {
|
640
|
+
uri = '#/'
|
641
|
+
} = params
|
642
|
+
|
643
|
+
const minProperties = getMinProperties(schema)
|
644
|
+
const maxProperties = getMaxProperties(schema)
|
645
|
+
|
646
|
+
const meta = renderObjectMeta(params, uri, minProperties, maxProperties)
|
647
|
+
const elements = renderObjectElements(schema, params)
|
648
|
+
|
649
|
+
return {
|
650
|
+
meta,
|
651
|
+
elements
|
652
|
+
}
|
653
|
+
}
|