@api-client/core 0.14.0 → 0.14.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.
Files changed (140) hide show
  1. package/build/src/amf/AmfTypes.d.ts +1 -1
  2. package/build/src/amf/AmfTypes.js +1 -1
  3. package/build/src/amf/AmfTypes.js.map +1 -1
  4. package/build/src/amf/Utils.d.ts +0 -6
  5. package/build/src/amf/Utils.d.ts.map +1 -1
  6. package/build/src/amf/Utils.js +0 -14
  7. package/build/src/amf/Utils.js.map +1 -1
  8. package/build/src/browser.d.ts +1 -0
  9. package/build/src/browser.d.ts.map +1 -1
  10. package/build/src/browser.js +1 -0
  11. package/build/src/browser.js.map +1 -1
  12. package/build/src/index.d.ts +1 -0
  13. package/build/src/index.d.ts.map +1 -1
  14. package/build/src/index.js +1 -0
  15. package/build/src/index.js.map +1 -1
  16. package/build/src/legacy.d.ts +0 -8
  17. package/build/src/legacy.d.ts.map +1 -1
  18. package/build/src/legacy.js +0 -9
  19. package/build/src/legacy.js.map +1 -1
  20. package/build/src/modeling/Bindings.d.ts +1 -1
  21. package/build/src/modeling/Bindings.js.map +1 -1
  22. package/build/src/modeling/DataDomain.js +2 -2
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DataFormat.d.ts +0 -40
  25. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  26. package/build/src/modeling/DataFormat.js +0 -27
  27. package/build/src/modeling/DataFormat.js.map +1 -1
  28. package/build/src/modeling/DomainAssociation.d.ts +28 -0
  29. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  30. package/build/src/modeling/DomainAssociation.js +73 -4
  31. package/build/src/modeling/DomainAssociation.js.map +1 -1
  32. package/build/src/modeling/DomainEntity.d.ts +25 -9
  33. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  34. package/build/src/modeling/DomainEntity.js +65 -21
  35. package/build/src/modeling/DomainEntity.js.map +1 -1
  36. package/build/src/modeling/DomainFile.d.ts +1 -1
  37. package/build/src/modeling/DomainFile.js +1 -1
  38. package/build/src/modeling/DomainFile.js.map +1 -1
  39. package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
  40. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  41. package/build/src/modeling/DomainImpactAnalysis.js +3 -3
  42. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  43. package/build/src/modeling/DomainModel.d.ts +2 -2
  44. package/build/src/modeling/DomainModel.js +2 -2
  45. package/build/src/modeling/DomainModel.js.map +1 -1
  46. package/build/src/modeling/DomainProperty.d.ts +28 -12
  47. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  48. package/build/src/modeling/DomainProperty.js +61 -26
  49. package/build/src/modeling/DomainProperty.js.map +1 -1
  50. package/build/src/modeling/Semantics.d.ts +109 -0
  51. package/build/src/modeling/Semantics.d.ts.map +1 -0
  52. package/build/src/modeling/Semantics.js +97 -0
  53. package/build/src/modeling/Semantics.js.map +1 -0
  54. package/build/src/models/kinds.d.ts +0 -24
  55. package/build/src/models/kinds.d.ts.map +1 -1
  56. package/build/src/models/kinds.js +0 -24
  57. package/build/src/models/kinds.js.map +1 -1
  58. package/build/src/models/store/data_catalog.d.ts +1 -1
  59. package/build/src/models/store/data_catalog.js.map +1 -1
  60. package/build/tsconfig.tsbuildinfo +1 -1
  61. package/data/models/example-generator-api.json +11 -11
  62. package/package.json +1 -1
  63. package/src/amf/AmfTypes.ts +1 -1
  64. package/src/amf/Utils.ts +0 -15
  65. package/src/modeling/Bindings.ts +1 -1
  66. package/src/modeling/DataDomain.ts +2 -2
  67. package/src/modeling/DataFormat.ts +0 -48
  68. package/src/modeling/DomainAssociation.ts +66 -3
  69. package/src/modeling/DomainEntity.ts +56 -17
  70. package/src/modeling/DomainFile.ts +1 -1
  71. package/src/modeling/DomainImpactAnalysis.ts +3 -3
  72. package/src/modeling/DomainModel.ts +2 -2
  73. package/src/modeling/DomainProperty.ts +60 -21
  74. package/src/modeling/Semantics.ts +178 -0
  75. package/src/modeling/graph.md +14 -14
  76. package/src/modeling/readme.md +29 -29
  77. package/src/models/kinds.ts +0 -25
  78. package/src/models/store/data_catalog.ts +1 -1
  79. package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
  80. package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
  81. package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
  82. package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
  83. package/tests/unit/modeling/domain_entity.spec.ts +27 -26
  84. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
  85. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
  86. package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
  87. package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
  88. package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
  89. package/build/src/amf/AmfShapeGenerator.js +0 -416
  90. package/build/src/amf/AmfShapeGenerator.js.map +0 -1
  91. package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
  92. package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
  93. package/build/src/modeling/legacy/DataAssociation.js +0 -443
  94. package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
  95. package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
  96. package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
  97. package/build/src/modeling/legacy/DataEntity.js +0 -855
  98. package/build/src/modeling/legacy/DataEntity.js.map +0 -1
  99. package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
  100. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
  101. package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
  102. package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
  103. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
  104. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
  105. package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
  106. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
  107. package/build/src/modeling/legacy/DataModel.d.ts +0 -99
  108. package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
  109. package/build/src/modeling/legacy/DataModel.js +0 -237
  110. package/build/src/modeling/legacy/DataModel.js.map +0 -1
  111. package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
  112. package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
  113. package/build/src/modeling/legacy/DataNamespace.js +0 -784
  114. package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
  115. package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
  116. package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
  117. package/build/src/modeling/legacy/DataProperty.js +0 -415
  118. package/build/src/modeling/legacy/DataProperty.js.map +0 -1
  119. package/build/src/models/store/DataFile.d.ts +0 -29
  120. package/build/src/models/store/DataFile.d.ts.map +0 -1
  121. package/build/src/models/store/DataFile.js +0 -87
  122. package/build/src/models/store/DataFile.js.map +0 -1
  123. package/src/amf/AmfShapeGenerator.ts +0 -477
  124. package/src/modeling/legacy/DataAssociation.ts +0 -554
  125. package/src/modeling/legacy/DataEntity.ts +0 -1019
  126. package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
  127. package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
  128. package/src/modeling/legacy/DataModel.ts +0 -276
  129. package/src/modeling/legacy/DataNamespace.ts +0 -929
  130. package/src/modeling/legacy/DataProperty.ts +0 -630
  131. package/src/models/store/DataFile.ts +0 -95
  132. package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
  133. package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
  134. package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
  135. package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
  136. package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
  137. package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
  138. package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
  139. package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
  140. package/tests/unit/modeling/legacy/impact_analysis.spec.ts +0 -373
@@ -1,477 +0,0 @@
1
- import { type PropertyWebBindings } from '../modeling/Bindings.js'
2
- import { DataAssociation } from '../modeling/legacy/DataAssociation.js'
3
- import { DataEntity } from '../modeling/legacy/DataEntity.js'
4
- import { DataProperty, type DataPropertySchema } from '../modeling/legacy/DataProperty.js'
5
- import { IAmfExampleTypes, modelTypeToAmfDataType } from './AmfTypes.js'
6
- import { AmfNamespace } from './definitions/Namespace.js'
7
- import {
8
- anyShape,
9
- arrayShape,
10
- fileShape,
11
- IApiAnyShape,
12
- IApiArrayShape,
13
- IApiDataExample,
14
- IApiFileShape,
15
- IApiNodeShape,
16
- IApiPropertyShape,
17
- IApiRecursiveShape,
18
- IApiScalarShape,
19
- IApiShape,
20
- IShapeUnion,
21
- nodeShape,
22
- propertyShape,
23
- recursiveShape,
24
- scalarShape,
25
- unionShape,
26
- } from './definitions/Shapes.js'
27
- import { AmfDataNode } from './models/AmfDataNode.js'
28
- import { nanoid } from '../nanoid.js'
29
- import { DataEntityKind, DataPropertyKind } from '../models/kinds.js'
30
- import { DataValueGenerator } from './DataValueGenerator.js'
31
-
32
- /**
33
- * Serializes Data shapes (DataEntity, DataProperty, DataAssociation) to AMF-related shapes.
34
- *
35
- * This is used when defining entities (according to the `DataEntity` schema)
36
- * and then we want to translate this into AMF shapes.
37
- *
38
- * @deprecated This class refers to the deprecated old data domain model.
39
- * Use the `ShapeGenerator` with the new domain model.
40
- */
41
- export class AmfShapeGenerator {
42
- #valueGenerator?: DataValueGenerator
43
-
44
- /**
45
- * Used with data domain value generation for entity properties.
46
- * Lazily loaded class only when functions are used.
47
- * This needs to be a class instances because some functions are incremental
48
- */
49
- get valueGenerator(): DataValueGenerator {
50
- if (!this.#valueGenerator) {
51
- this.#valueGenerator = new DataValueGenerator()
52
- }
53
- return this.#valueGenerator
54
- }
55
-
56
- /**
57
- * Serializes the Entity to the AMF node shape.
58
- *
59
- * @param input The Property to serialize.
60
- * @param generatedEntities The list keys of already generated entities. This prohibits recursive shape generation.
61
- */
62
- entity(input: DataEntity, generatedEntities: string[] = []): IApiNodeShape | IApiRecursiveShape {
63
- if (generatedEntities.includes(input.key)) {
64
- // create a recursive shape.
65
- return this._recursiveShape(input)
66
- }
67
- generatedEntities.push(input.key)
68
- const result = nodeShape(input.key)
69
- result.id = input.key
70
- this._updateBaseProperties(input, result)
71
- result.properties = []
72
- input.properties.forEach((item) => {
73
- // we check whether the property is hidden.
74
- // This is not happening when calling the `property()` because this method
75
- // always returns the AMF shape.
76
- const wb = item.readBinding('web') as PropertyWebBindings | undefined
77
- if (wb && wb.hidden) {
78
- return
79
- }
80
- const shape = this.property(item)
81
- result.properties.push(shape)
82
- })
83
- input.associations.forEach((assoc) => {
84
- const prop = this.associationProperty(assoc, generatedEntities)
85
- result.properties.push(prop)
86
- })
87
- input.getComputedParents().forEach((parent) => {
88
- const shape = this.entity(parent, generatedEntities)
89
- result.inherits.push(shape)
90
- })
91
- return result
92
- }
93
-
94
- /**
95
- * Serializes an Entity Property to the AMF property shape.
96
- *
97
- * @param input The Property to serialize.
98
- */
99
- property(input: DataProperty): IApiPropertyShape {
100
- const { required, key } = input
101
- const result = propertyShape(key)
102
- result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`
103
- if (required) {
104
- result.minCount = 1
105
- }
106
- result.range = this._readPropertyRange(input)
107
-
108
- // for example, Example generator needs to know the name of the property
109
- // as it does not look into the "range" object.
110
- this._updateBaseProperties(input, result)
111
-
112
- // sync the name of the property shape with the range, in case it was changed by the bindings
113
- if (result.range.name) {
114
- result.name = result.range.name
115
- }
116
- return result
117
- }
118
-
119
- /**
120
- * Serializes an Entity property to the AMF property shape with association
121
- * targets as defined in the schema configuration.
122
- *
123
- * @param input The Property to serialize.
124
- */
125
- associationProperty(input: DataAssociation, generatedEntities: string[] = []): IApiPropertyShape {
126
- const { required, key } = input
127
- const result = propertyShape(key)
128
- result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`
129
- if (required) {
130
- result.minCount = 1
131
- }
132
- result.range = this.associationShape(input, generatedEntities)
133
- this._updateBaseProperties(input, result)
134
- return result
135
- }
136
-
137
- /**
138
- * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.
139
- *
140
- * @param input The data association instance.
141
- * @returns The range value for the PropertyShape.
142
- */
143
- associationShape(input: DataAssociation, generatedEntities: string[] = []): IShapeUnion | undefined {
144
- const schema = input.schema
145
- if (schema && schema.linked) {
146
- // This is a link to the schema. In an API that would be the id
147
- // of a resource to request the data from.
148
- const range = scalarShape(input.key)
149
- range.id = `link-${input.key}`
150
- range.dataType = modelTypeToAmfDataType('string')
151
- return range
152
- }
153
- const items = this.associationUnion(input, generatedEntities)
154
- if (!items) {
155
- return
156
- }
157
- const unionType = (schema && schema.unionType) || 'anyOf'
158
- if (Array.isArray(items)) {
159
- const range = unionShape(input.key)
160
- this._updateBaseProperties(input, range)
161
- range.anyOf = []
162
- if (unionType === 'anyOf') {
163
- range.anyOf = items
164
- } else if (unionType === 'allOf') {
165
- range.and = items
166
- } else if (unionType === 'oneOf') {
167
- range.xone = items
168
- } else {
169
- // not.
170
- range.not = items[0] // ?
171
- }
172
- if (input.multiple) {
173
- return this.refactorShapeToArray(input.key, range)
174
- }
175
- return range
176
- }
177
- if (unionType === 'not') {
178
- const wrapper = anyShape(input.key)
179
- wrapper.id = `not-shape-${input.key}`
180
- wrapper.not = items
181
- return wrapper
182
- }
183
- if (input.multiple) {
184
- return this.refactorShapeToArray(input.key, items)
185
- }
186
- return items
187
- }
188
-
189
- /**
190
- * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.
191
- *
192
- * @param input The data association instance.
193
- * @returns The range value for the PropertyShape.
194
- */
195
- associationUnion(input: DataAssociation, generatedEntities: string[] = []): IShapeUnion | IShapeUnion[] | undefined {
196
- const targets = input.getTargets().map((i) => this.entity(i, generatedEntities))
197
- if (!targets.length) {
198
- return undefined
199
- }
200
- if (targets.length > 1) {
201
- return targets
202
- }
203
- return targets[0]
204
- }
205
-
206
- /**
207
- * The DataProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for
208
- * default value, examples, and enum values. We also look for the `web`
209
- * bindings for more detailed definition of a shape.
210
- *
211
- * @param input
212
- * @returns
213
- */
214
- protected _readPropertyRange(input: DataProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {
215
- const bindings = input.readBinding('web') as PropertyWebBindings | undefined
216
- let schema: DataPropertySchema | undefined
217
- if (input.schema) {
218
- schema = input.schema
219
- }
220
- return this._createAmfSchema(input, schema, bindings)
221
- }
222
-
223
- protected _createAmfSchema(
224
- input: DataProperty,
225
- schema?: DataPropertySchema,
226
- bindings?: PropertyWebBindings
227
- ): IApiArrayShape | IApiFileShape | IApiScalarShape {
228
- const { multiple, type } = input
229
- if (multiple) {
230
- return this._generateArrayShape(input, schema, bindings)
231
- }
232
- if (type === 'binary') {
233
- return this._generateFileShape(input, schema, bindings)
234
- }
235
- return this._generateScalarShape(input, schema, bindings)
236
- }
237
-
238
- /**
239
- * Normally this would be part of generating a scalar schema but the the property is an array this
240
- * is generated on the array and not on the range.
241
- *
242
- * @param result The scalar or array shape.
243
- * @param schema The property schema
244
- * @param type The data type of the parent property as set on the `range`
245
- * @param isArray Whether the DataProperty is multiple
246
- */
247
- protected _setShapeSchema(
248
- input: DataProperty,
249
- result: IApiAnyShape,
250
- schema: DataPropertySchema,
251
- type: string,
252
- isArray?: boolean
253
- ): void {
254
- if (schema.defaultValue) {
255
- const { type: dfFormat } = schema.defaultValue
256
- const { value } = schema.defaultValue
257
- if (dfFormat === 'function') {
258
- const tmp = this.valueGenerator.generate(value, input.type)
259
- if (tmp !== DataValueGenerator.noValue) {
260
- const dt = AmfDataNode.scalar(tmp as string, dfFormat)
261
- result.defaultValue = dt.toJSON()
262
- }
263
- } else {
264
- const dt = AmfDataNode.scalar(value, type)
265
- result.defaultValue = dt.toJSON()
266
- }
267
- }
268
- if (Array.isArray(schema.enum)) {
269
- result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())
270
- }
271
- if (Array.isArray(schema.examples)) {
272
- if (isArray) {
273
- result.examples = this._generateArrayExamples(schema.examples, type)
274
- } else {
275
- result.examples = this._generateExamples(schema.examples, type)
276
- }
277
- }
278
- }
279
-
280
- protected _generateArrayShape(
281
- input: DataProperty,
282
- schema?: DataPropertySchema,
283
- bindings?: PropertyWebBindings
284
- ): IApiArrayShape {
285
- const result = arrayShape(input.key)
286
- const { type } = input
287
- if (type === 'binary') {
288
- // we do not pass schema to the range generator as we set schema's properties on the array shape.
289
- result.items = this._generateFileShape(input, undefined, bindings)
290
- } else {
291
- result.items = this._generateScalarShape(input, undefined, bindings)
292
- }
293
- if (schema) {
294
- const type = (result.items as IApiScalarShape).dataType as string
295
- this._setShapeSchema(input, result, schema, type, input.multiple)
296
- }
297
- return result
298
- }
299
-
300
- protected _generateScalarShape(
301
- input: DataProperty,
302
- schema?: DataPropertySchema,
303
- bindings?: PropertyWebBindings
304
- ): IApiScalarShape {
305
- const result = scalarShape(input.key)
306
- this._updateBaseProperties(input, result)
307
- this._fillScalarShapeCommonProperties(result, input, bindings)
308
- if (!result.dataType) {
309
- result.dataType = modelTypeToAmfDataType(input.type, bindings)
310
- }
311
- if (schema) {
312
- this._setShapeSchema(input, result, schema, result.dataType as string, input.multiple)
313
- }
314
- return result
315
- }
316
-
317
- protected _generateExamples(examples: string[], type: string): IApiDataExample[] {
318
- return examples.map((current) => {
319
- const value = AmfDataNode.scalar(current, type).toJSON()
320
- const item: IApiDataExample = {
321
- id: nanoid(),
322
- customDomainProperties: [],
323
- strict: true,
324
- types: IAmfExampleTypes,
325
- structuredValue: value,
326
- }
327
- return item
328
- })
329
- }
330
-
331
- protected _generateArrayExamples(examples: string[], type: string): IApiDataExample[] {
332
- const item: IApiDataExample = {
333
- id: nanoid(),
334
- customDomainProperties: [],
335
- strict: true,
336
- types: IAmfExampleTypes,
337
- }
338
- const value = new AmfDataNode('array')
339
- examples.forEach((item) => {
340
- const member = AmfDataNode.scalar(item, type)
341
- value.addMember(member)
342
- })
343
- item.structuredValue = value.toJSON()
344
- return [item]
345
- }
346
-
347
- protected _generateFileShape(
348
- input: DataProperty,
349
- schema?: DataPropertySchema,
350
- bindings?: PropertyWebBindings
351
- ): IApiFileShape {
352
- // if (bindings && bindings.format === 'base64') {
353
- // // this is a binary format of a string shape
354
- // }
355
- const result = fileShape(input.key)
356
- this._updateBaseProperties(input, result)
357
- if (bindings) {
358
- if (Array.isArray(bindings.fileTypes)) {
359
- result.fileTypes = bindings.fileTypes
360
- }
361
- this._fillScalarShapeCommonProperties(result, input, bindings)
362
- if (bindings.format === 'base64') {
363
- result.format = AmfNamespace.w3.xmlSchema.base64Binary
364
- }
365
- }
366
- return result
367
- }
368
-
369
- protected _fillScalarShapeCommonProperties(
370
- result: IApiFileShape | IApiScalarShape,
371
- input: DataProperty,
372
- bindings?: PropertyWebBindings
373
- ): void {
374
- if (bindings?.name) {
375
- result.name = bindings.name
376
- }
377
- if (bindings?.xml) {
378
- result.xmlSerialization = bindings.xml
379
- }
380
- if (bindings?.pattern) {
381
- result.pattern = bindings.pattern
382
- }
383
- const { schema, type } = input
384
- if (schema) {
385
- if (typeof schema.multipleOf === 'number') {
386
- result.multipleOf = schema.multipleOf
387
- }
388
- if (typeof schema.minimum === 'number') {
389
- if (type === 'string') {
390
- result.minLength = schema.minimum
391
- } else {
392
- result.minimum = schema.minimum
393
- }
394
- }
395
- if (typeof schema.maximum === 'number') {
396
- if (type === 'string') {
397
- result.maxLength = schema.maximum
398
- } else {
399
- result.maximum = schema.maximum
400
- }
401
- }
402
- if (typeof schema.exclusiveMinimum === 'boolean') {
403
- result.exclusiveMinimum = schema.exclusiveMinimum
404
- }
405
- if (typeof schema.exclusiveMaximum === 'boolean') {
406
- result.exclusiveMaximum = schema.exclusiveMaximum
407
- }
408
- }
409
- if (bindings?.format) {
410
- switch (bindings.format) {
411
- case 'base64':
412
- result.format = AmfNamespace.w3.xmlSchema.base64Binary
413
- break
414
- case 'double':
415
- result.format = AmfNamespace.w3.xmlSchema.double
416
- break
417
- case 'float':
418
- result.format = AmfNamespace.w3.xmlSchema.float
419
- break
420
- case 'int32':
421
- result.format = AmfNamespace.w3.xmlSchema.integer
422
- break
423
- case 'int64':
424
- result.format = AmfNamespace.w3.xmlSchema.integer
425
- break
426
- }
427
- // result.format = bindings.format
428
- }
429
- if (typeof input.readOnly === 'boolean') {
430
- result.readOnly = input.readOnly
431
- }
432
- if (typeof input.writeOnly === 'boolean') {
433
- result.writeOnly = input.writeOnly
434
- }
435
- }
436
-
437
- protected _updateBaseProperties(input: DataProperty | DataAssociation | DataEntity, target: IApiShape): void {
438
- // const bindings = input.readBinding('web') as PropertyWebBindings | undefined
439
- target.name = input.info.name
440
- target.displayName = input.info.displayName
441
- target.description = input.info.description
442
- if (input.kind === DataPropertyKind) {
443
- target.deprecated = (input as DataProperty).deprecated
444
- } else if (input.kind === DataEntityKind) {
445
- target.deprecated = (input as DataEntity).deprecated
446
- }
447
- }
448
-
449
- protected _recursiveShape(input: DataEntity): IApiRecursiveShape {
450
- return recursiveShape(input.key, input.key)
451
- }
452
-
453
- /**
454
- * Translates generated schema from an array shape to the shape defined in the `items` of the array.
455
- *
456
- * @param array The source array.
457
- * @returns The definition of the `items` of the array.
458
- */
459
- refactorArrayToShape(array: IApiArrayShape): IShapeUnion {
460
- const { items } = array
461
- return items as IShapeUnion
462
- }
463
-
464
- /**
465
- * Translates the shape to an array shape. This happens when data model property
466
- * is changed from 'multiple' to not-multiple and back.
467
- *
468
- * @param id The key of the parameter or an association
469
- * @param shape The shape to wrap as an array.
470
- * @returns Array shape.
471
- */
472
- refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {
473
- const result = arrayShape(id)
474
- result.items = shape
475
- return result
476
- }
477
- }