@api-client/core 0.6.13 → 0.6.16
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/build/browser.d.ts +9 -2
- package/build/browser.js +12 -2
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +9 -2
- package/build/index.js +12 -2
- package/build/index.js.map +1 -1
- package/build/src/amf/AmfMixin.d.ts +395 -0
- package/build/src/amf/AmfMixin.js +1146 -0
- package/build/src/amf/AmfMixin.js.map +1 -0
- package/build/src/amf/AmfSerializer.d.ts +136 -0
- package/build/src/amf/AmfSerializer.js +1913 -0
- package/build/src/amf/AmfSerializer.js.map +1 -0
- package/build/src/amf/AmfShapeGenerator.d.ts +85 -0
- package/build/src/amf/AmfShapeGenerator.js +385 -0
- package/build/src/amf/AmfShapeGenerator.js.map +1 -0
- package/build/src/amf/AmfTypes.d.ts +24 -0
- package/build/src/amf/AmfTypes.js +122 -0
- package/build/src/amf/AmfTypes.js.map +1 -0
- package/build/src/amf/ApiExampleGenerator.d.ts +36 -0
- package/build/src/amf/ApiExampleGenerator.js +109 -0
- package/build/src/amf/ApiExampleGenerator.js.map +1 -0
- package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +67 -0
- package/build/src/amf/ApiMonacoSchemaGenerator.js +243 -0
- package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -0
- package/build/src/amf/ApiSchemaGenerator.d.ts +55 -0
- package/build/src/amf/ApiSchemaGenerator.js +94 -0
- package/build/src/amf/ApiSchemaGenerator.js.map +1 -0
- package/build/src/amf/ApiSchemaValues.d.ts +98 -0
- package/build/src/amf/ApiSchemaValues.js +382 -0
- package/build/src/amf/ApiSchemaValues.js.map +1 -0
- package/build/src/amf/Utils.d.ts +41 -0
- package/build/src/amf/Utils.js +176 -0
- package/build/src/amf/Utils.js.map +1 -0
- package/build/src/amf/data-node/DataNodeBase.d.ts +31 -0
- package/build/src/amf/data-node/DataNodeBase.js +77 -0
- package/build/src/amf/data-node/DataNodeBase.js.map +1 -0
- package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +15 -0
- package/build/src/amf/data-node/JsonDataNodeGenerator.js +24 -0
- package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -0
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +13 -0
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js +42 -0
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -0
- package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +21 -0
- package/build/src/amf/data-node/XmlDataNodeGenerator.js +30 -0
- package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -0
- package/build/src/amf/definitions/Amf.d.ts +362 -0
- package/build/src/amf/definitions/Amf.js +2 -0
- package/build/src/amf/definitions/Amf.js.map +1 -0
- package/build/src/amf/definitions/Api.d.ts +381 -0
- package/build/src/amf/definitions/Api.js +2 -0
- package/build/src/amf/definitions/Api.js.map +1 -0
- package/build/src/amf/definitions/Base.d.ts +11 -0
- package/build/src/amf/definitions/Base.js +2 -0
- package/build/src/amf/definitions/Base.js.map +1 -0
- package/build/src/amf/definitions/Namespace.d.ts +311 -0
- package/build/src/amf/definitions/Namespace.js +330 -0
- package/build/src/amf/definitions/Namespace.js.map +1 -0
- package/build/src/amf/definitions/Shapes.d.ts +309 -0
- package/build/src/amf/definitions/Shapes.js +87 -0
- package/build/src/amf/definitions/Shapes.js.map +1 -0
- package/build/src/amf/models/AmfDataNode.d.ts +68 -0
- package/build/src/amf/models/AmfDataNode.js +188 -0
- package/build/src/amf/models/AmfDataNode.js.map +1 -0
- package/build/src/amf/shape/ShapeBase.d.ts +75 -0
- package/build/src/amf/shape/ShapeBase.js +90 -0
- package/build/src/amf/shape/ShapeBase.js.map +1 -0
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +46 -0
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +406 -0
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -0
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +84 -0
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +820 -0
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -0
- package/build/src/models/Thing.d.ts +17 -0
- package/build/src/models/Thing.js +19 -1
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/data/Bindings.d.ts +161 -0
- package/build/src/models/data/Bindings.js +2 -0
- package/build/src/models/data/Bindings.js.map +1 -0
- package/build/src/models/data/DataAssociation.d.ts +135 -14
- package/build/src/models/data/DataAssociation.js +154 -21
- package/build/src/models/data/DataAssociation.js.map +1 -1
- package/build/src/models/data/DataAssociationSchema.d.ts +36 -0
- package/build/src/models/data/DataEntity.d.ts +76 -4
- package/build/src/models/data/DataEntity.js +136 -9
- package/build/src/models/data/DataEntity.js.map +1 -1
- package/build/src/models/data/DataFile.d.ts +3 -0
- package/build/src/models/data/DataFile.js +3 -0
- package/build/src/models/data/DataFile.js.map +1 -1
- package/build/src/models/data/DataModel.d.ts +1 -1
- package/build/src/models/data/DataModel.js.map +1 -1
- package/build/src/models/data/DataNamespace.d.ts +6 -0
- package/build/src/models/data/DataNamespace.js +11 -1
- package/build/src/models/data/DataNamespace.js.map +1 -1
- package/build/src/models/data/DataProperty.d.ts +131 -36
- package/build/src/models/data/DataProperty.js +200 -17
- package/build/src/models/data/DataProperty.js.map +1 -1
- package/data/apis/oas-date/oas-date.yaml +28 -0
- package/data/apis/oas-types/oas-types.yaml +159 -0
- package/data/apis/oas-unions/oas-unions.yaml +75 -0
- package/data/apis/raml-date/raml-date.raml +28 -0
- package/data/apis/recursive/recursive.raml +14 -0
- package/data/apis/schema-api/examples/person.json +14 -0
- package/data/apis/schema-api/examples/person.raml +14 -0
- package/data/apis/schema-api/examples/person.url.encoded +1 -0
- package/data/apis/schema-api/examples/person.xml +14 -0
- package/data/apis/schema-api/library/demo-types.raml +43 -0
- package/data/apis/schema-api/schema-api.raml +644 -0
- package/data/apis/schema-api/schemas/person.json +104 -0
- package/data/apis/schema-api/schemas/person.xsd +26 -0
- package/data/apis/schema-api/types/DemoPerson.raml +67 -0
- package/data/model.js +106 -0
- package/data/models/oas-date.json +637 -0
- package/data/models/oas-types.json +5352 -0
- package/data/models/oas-unions.json +1881 -0
- package/data/models/raml-date.json +1096 -0
- package/data/models/recursive.json +610 -0
- package/data/models/schema-api.json +37319 -0
- package/package.json +9 -6
- package/src/amf/AmfMixin.ts +1623 -0
- package/src/amf/AmfSerializer.ts +2028 -0
- package/src/amf/AmfShapeGenerator.ts +400 -0
- package/src/amf/AmfTypes.ts +126 -0
- package/src/amf/ApiExampleGenerator.ts +112 -0
- package/src/amf/ApiMonacoSchemaGenerator.ts +296 -0
- package/src/amf/ApiSchemaGenerator.ts +108 -0
- package/src/amf/ApiSchemaValues.ts +411 -0
- package/src/amf/Utils.ts +182 -0
- package/src/amf/data-node/DataNodeBase.ts +81 -0
- package/src/amf/data-node/JsonDataNodeGenerator.ts +26 -0
- package/src/amf/data-node/README.md +3 -0
- package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +43 -0
- package/src/amf/data-node/XmlDataNodeGenerator.ts +38 -0
- package/src/amf/definitions/Amf.ts +443 -0
- package/src/amf/definitions/Api.ts +427 -0
- package/src/amf/definitions/Base.ts +13 -0
- package/src/amf/definitions/Namespace.ts +341 -0
- package/src/amf/definitions/Shapes.ts +414 -0
- package/src/amf/models/AmfDataNode.ts +200 -0
- package/src/amf/shape/README.md +4 -0
- package/src/amf/shape/ShapeBase.ts +160 -0
- package/src/amf/shape/ShapeJsonSchemaGenerator.ts +422 -0
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +876 -0
- package/src/models/Thing.ts +25 -1
- package/src/models/data/Bindings.ts +186 -0
- package/src/models/data/DataAssociation.ts +226 -29
- package/src/models/data/DataAssociationSchema.ts +38 -0
- package/src/models/data/DataEntity.ts +170 -13
- package/src/models/data/DataFile.ts +3 -0
- package/src/models/data/DataModel.ts +1 -1
- package/src/models/data/DataNamespace.ts +16 -1
- package/src/models/data/DataProperty.ts +250 -47
- package/build/src/models/data/DataPropertySchema.d.ts +0 -125
- package/build/src/models/data/DataPropertySchema.js +0 -33
- package/build/src/models/data/DataPropertySchema.js.map +0 -1
- package/src/models/data/DataPropertySchema.ts +0 -156
|
@@ -1,21 +1,35 @@
|
|
|
1
|
+
import { Core as JsonCore } from '@api-client/json';
|
|
1
2
|
import { Thing } from "../Thing.js";
|
|
2
3
|
import v4 from '../../lib/uuid.js';
|
|
4
|
+
import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js';
|
|
3
5
|
export const DataPropertyTypes = [
|
|
4
|
-
'string', 'number', 'nil', 'boolean', 'date', 'datetime', 'time', '
|
|
6
|
+
'string', 'number', 'integer', 'nil', 'boolean', 'date', 'datetime', 'time', 'any', 'binary'
|
|
5
7
|
];
|
|
6
8
|
export var DataPropertyList;
|
|
7
9
|
(function (DataPropertyList) {
|
|
8
10
|
DataPropertyList["string"] = "string";
|
|
9
11
|
DataPropertyList["number"] = "number";
|
|
12
|
+
DataPropertyList["integer"] = "integer";
|
|
10
13
|
DataPropertyList["nil"] = "nil";
|
|
11
14
|
DataPropertyList["boolean"] = "boolean";
|
|
12
15
|
DataPropertyList["date"] = "date";
|
|
13
16
|
DataPropertyList["datetime"] = "datetime";
|
|
14
17
|
DataPropertyList["time"] = "time";
|
|
15
|
-
DataPropertyList["bytes"] = "bytes";
|
|
16
18
|
DataPropertyList["any"] = "any";
|
|
17
|
-
DataPropertyList["file"] = "
|
|
19
|
+
DataPropertyList["file"] = "binary";
|
|
18
20
|
})(DataPropertyList || (DataPropertyList = {}));
|
|
21
|
+
export const DateFormats = ['rfc3339', 'rfc2616'];
|
|
22
|
+
export var DateFormatList;
|
|
23
|
+
(function (DateFormatList) {
|
|
24
|
+
/**
|
|
25
|
+
* The "date-time" notation of RFC3339
|
|
26
|
+
*/
|
|
27
|
+
DateFormatList["rfc3339"] = "rfc3339";
|
|
28
|
+
/**
|
|
29
|
+
* The format defined in RFC2616.
|
|
30
|
+
*/
|
|
31
|
+
DateFormatList["rfc2616"] = "rfc2616";
|
|
32
|
+
})(DateFormatList || (DateFormatList = {}));
|
|
19
33
|
export const Kind = 'Core#DataProperty';
|
|
20
34
|
export class DataProperty {
|
|
21
35
|
root;
|
|
@@ -41,8 +55,28 @@ export class DataProperty {
|
|
|
41
55
|
* Whether this property describes an indexed property of the entity.
|
|
42
56
|
*/
|
|
43
57
|
index;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the property is read only in the schema.
|
|
60
|
+
*/
|
|
61
|
+
readOnly;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the property is write only in the schema.
|
|
64
|
+
*/
|
|
65
|
+
writeOnly;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the attribute is hidden in the schema (not a part of it).
|
|
68
|
+
* The hidden attribute should only appear in the adapted attribute.
|
|
69
|
+
* Has no effect when added to the "main" attribute.
|
|
70
|
+
*/
|
|
71
|
+
hidden;
|
|
72
|
+
/**
|
|
73
|
+
* Whether this property is deprecated.
|
|
74
|
+
*/
|
|
75
|
+
deprecated;
|
|
44
76
|
/**
|
|
45
77
|
* Optional general purpose tags for the UI.
|
|
78
|
+
*
|
|
79
|
+
* Note to implementations, use the `addTag()` method as it propagates the "tag" value in the namespace.
|
|
46
80
|
*/
|
|
47
81
|
tags = [];
|
|
48
82
|
/**
|
|
@@ -60,14 +94,29 @@ export class DataProperty {
|
|
|
60
94
|
*/
|
|
61
95
|
type = 'string';
|
|
62
96
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
97
|
+
* The general schema definition of this property.
|
|
98
|
+
* This is propagated to all bindings (when they support these properties).
|
|
99
|
+
*
|
|
100
|
+
* Note, schema can only occur on an adapted property. Has no effect on the "main"
|
|
101
|
+
* property.
|
|
102
|
+
*/
|
|
103
|
+
schema;
|
|
104
|
+
/**
|
|
105
|
+
* The list of bindings for this property.
|
|
106
|
+
*
|
|
107
|
+
* A binding defines a translation from a data model to a specific format.
|
|
108
|
+
* For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs
|
|
109
|
+
* or a protocol buffer schema.
|
|
110
|
+
*/
|
|
111
|
+
bindings = [];
|
|
112
|
+
/**
|
|
113
|
+
* The key of the property that is adapted by this property.
|
|
114
|
+
* Adapted properties can manipulate the shape of the schema for the property.
|
|
115
|
+
*
|
|
116
|
+
* Each value defined on the adapted property changes the original value defined on
|
|
117
|
+
* the property.
|
|
69
118
|
*/
|
|
70
|
-
|
|
119
|
+
adapts;
|
|
71
120
|
static get supportedTypes() {
|
|
72
121
|
return [...DataPropertyTypes];
|
|
73
122
|
}
|
|
@@ -107,7 +156,7 @@ export class DataProperty {
|
|
|
107
156
|
if (!DataProperty.isDataProperty(init)) {
|
|
108
157
|
throw new Error(`Not a data property.`);
|
|
109
158
|
}
|
|
110
|
-
const { info, key = v4(), kind = Kind, multiple, required, type = DataPropertyList.string, index, primary, tags, taxonomy,
|
|
159
|
+
const { info, key = v4(), kind = Kind, multiple, required, type = DataPropertyList.string, index, primary, readOnly, writeOnly, adapts, hidden, tags, taxonomy, deprecated, schema, bindings, } = init;
|
|
111
160
|
this.kind = kind;
|
|
112
161
|
this.key = key;
|
|
113
162
|
this.type = type;
|
|
@@ -135,12 +184,42 @@ export class DataProperty {
|
|
|
135
184
|
else {
|
|
136
185
|
this.index = undefined;
|
|
137
186
|
}
|
|
187
|
+
if (typeof deprecated === 'boolean') {
|
|
188
|
+
this.deprecated = deprecated;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.deprecated = undefined;
|
|
192
|
+
}
|
|
138
193
|
if (typeof primary === 'boolean') {
|
|
139
194
|
this.primary = primary;
|
|
140
195
|
}
|
|
141
196
|
else {
|
|
142
197
|
this.primary = undefined;
|
|
143
198
|
}
|
|
199
|
+
if (typeof readOnly === 'boolean') {
|
|
200
|
+
this.readOnly = readOnly;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this.readOnly = undefined;
|
|
204
|
+
}
|
|
205
|
+
if (typeof writeOnly === 'boolean') {
|
|
206
|
+
this.writeOnly = writeOnly;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this.writeOnly = undefined;
|
|
210
|
+
}
|
|
211
|
+
if (typeof hidden === 'boolean') {
|
|
212
|
+
this.hidden = hidden;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.hidden = undefined;
|
|
216
|
+
}
|
|
217
|
+
if (typeof adapts === 'string') {
|
|
218
|
+
this.adapts = adapts;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.adapts = undefined;
|
|
222
|
+
}
|
|
144
223
|
if (Array.isArray(tags)) {
|
|
145
224
|
this.tags = [...tags];
|
|
146
225
|
}
|
|
@@ -153,11 +232,17 @@ export class DataProperty {
|
|
|
153
232
|
else {
|
|
154
233
|
this.taxonomy = [];
|
|
155
234
|
}
|
|
156
|
-
if (
|
|
157
|
-
this.
|
|
235
|
+
if (schema) {
|
|
236
|
+
this.schema = JsonCore.clone(schema);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
this.schema = undefined;
|
|
240
|
+
}
|
|
241
|
+
if (Array.isArray(bindings)) {
|
|
242
|
+
this.bindings = bindings.map(i => JsonCore.clone(i));
|
|
158
243
|
}
|
|
159
244
|
else {
|
|
160
|
-
this.
|
|
245
|
+
this.bindings = [];
|
|
161
246
|
}
|
|
162
247
|
}
|
|
163
248
|
static isDataProperty(input) {
|
|
@@ -177,6 +262,9 @@ export class DataProperty {
|
|
|
177
262
|
if (typeof this.index === 'boolean') {
|
|
178
263
|
result.index = this.index;
|
|
179
264
|
}
|
|
265
|
+
if (typeof this.deprecated === 'boolean') {
|
|
266
|
+
result.deprecated = this.deprecated;
|
|
267
|
+
}
|
|
180
268
|
if (typeof this.primary === 'boolean') {
|
|
181
269
|
result.primary = this.primary;
|
|
182
270
|
}
|
|
@@ -186,14 +274,29 @@ export class DataProperty {
|
|
|
186
274
|
if (typeof this.required === 'boolean') {
|
|
187
275
|
result.required = this.required;
|
|
188
276
|
}
|
|
277
|
+
if (typeof this.readOnly === 'boolean') {
|
|
278
|
+
result.readOnly = this.readOnly;
|
|
279
|
+
}
|
|
280
|
+
if (typeof this.writeOnly === 'boolean') {
|
|
281
|
+
result.writeOnly = this.writeOnly;
|
|
282
|
+
}
|
|
283
|
+
if (typeof this.hidden === 'boolean') {
|
|
284
|
+
result.hidden = this.hidden;
|
|
285
|
+
}
|
|
286
|
+
if (this.adapts) {
|
|
287
|
+
result.adapts = this.adapts;
|
|
288
|
+
}
|
|
189
289
|
if (Array.isArray(this.tags) && this.tags.length) {
|
|
190
290
|
result.tags = [...this.tags];
|
|
191
291
|
}
|
|
192
292
|
if (Array.isArray(this.taxonomy) && this.taxonomy.length) {
|
|
193
293
|
result.taxonomy = [...this.taxonomy];
|
|
194
294
|
}
|
|
195
|
-
if (
|
|
196
|
-
result.
|
|
295
|
+
if (this.schema) {
|
|
296
|
+
result.schema = JsonCore.clone(this.schema);
|
|
297
|
+
}
|
|
298
|
+
if (Array.isArray(this.bindings) && this.bindings.length) {
|
|
299
|
+
result.taxonomy = this.taxonomy.map(i => JsonCore.clone(i));
|
|
197
300
|
}
|
|
198
301
|
return result;
|
|
199
302
|
}
|
|
@@ -201,7 +304,7 @@ export class DataProperty {
|
|
|
201
304
|
* Removes self from the parent entity and the namespace definition.
|
|
202
305
|
*/
|
|
203
306
|
remove() {
|
|
204
|
-
const { root } = this;
|
|
307
|
+
const { root, adapts } = this;
|
|
205
308
|
const entity = root.definitions.entities.find(i => i.properties.some(j => j === this));
|
|
206
309
|
if (entity) {
|
|
207
310
|
const assocIndex = entity.properties.findIndex(i => i === this);
|
|
@@ -211,6 +314,86 @@ export class DataProperty {
|
|
|
211
314
|
if (defIndex >= 0) {
|
|
212
315
|
this.root.definitions.properties.splice(defIndex, 1);
|
|
213
316
|
}
|
|
317
|
+
if (adapts) {
|
|
318
|
+
const adaptsIndex = this.root.definitions.properties.findIndex(i => i.key === adapts);
|
|
319
|
+
if (adaptsIndex >= 0) {
|
|
320
|
+
this.root.definitions.properties.splice(adaptsIndex, 1);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Adds a new tag to the property. It also populates the root namespace's tags when tag is new.
|
|
326
|
+
*
|
|
327
|
+
* Note, it does nothing when the tag is already defined.
|
|
328
|
+
*
|
|
329
|
+
* @param tag The tag to add.
|
|
330
|
+
*/
|
|
331
|
+
addTag(tag) {
|
|
332
|
+
if (!tag) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const lower = tag.toLowerCase();
|
|
336
|
+
const { tags } = this;
|
|
337
|
+
if (tags.some(t => t.toLowerCase() === lower)) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
tags.push(tag);
|
|
341
|
+
const { definitions } = this.root;
|
|
342
|
+
if (!definitions.tags.some(t => t.toLowerCase() === lower)) {
|
|
343
|
+
definitions.tags.push(tag);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.
|
|
348
|
+
*
|
|
349
|
+
* @param tag The tag to remove.
|
|
350
|
+
*/
|
|
351
|
+
removeTag(tag) {
|
|
352
|
+
if (!tag) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const lower = tag.toLowerCase();
|
|
356
|
+
const { tags } = this;
|
|
357
|
+
const index = tags.findIndex(t => t.toLowerCase() === lower);
|
|
358
|
+
if (index >= 0) {
|
|
359
|
+
tags.splice(index, 1);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Creates a Property Shape of AMF.
|
|
364
|
+
* The property itself is auto-generated. If the `schema` is defined then it is used
|
|
365
|
+
* as the `range` of the property. Otherwise basic shape is generated for the range.
|
|
366
|
+
*
|
|
367
|
+
* This is a preferred way of reading the AMF shape as this synchronizes changed
|
|
368
|
+
* data properties with the shape definition.
|
|
369
|
+
*
|
|
370
|
+
* @returns AMF property shape definition.
|
|
371
|
+
*/
|
|
372
|
+
toApiShape() {
|
|
373
|
+
const serializer = new AmfShapeGenerator();
|
|
374
|
+
return serializer.property(this);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @returns The adapted property, if any
|
|
378
|
+
*/
|
|
379
|
+
readAdapted() {
|
|
380
|
+
const { adapts } = this;
|
|
381
|
+
if (!adapts) {
|
|
382
|
+
return undefined;
|
|
383
|
+
}
|
|
384
|
+
return this.root.definitions.properties.find(i => i.key === adapts);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Creates new adapted property and associates it with this property.
|
|
388
|
+
* @returns The instance of the created property.
|
|
389
|
+
*/
|
|
390
|
+
createAdapted() {
|
|
391
|
+
const property = new DataProperty(this.root);
|
|
392
|
+
// disallow defaults as this would influence the schema generation
|
|
393
|
+
property.info.name = undefined;
|
|
394
|
+
this.root.definitions.properties.push(property);
|
|
395
|
+
this.adapts = property.key;
|
|
396
|
+
return property;
|
|
214
397
|
}
|
|
215
398
|
}
|
|
216
399
|
//# sourceMappingURL=DataProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProperty.js","sourceRoot":"","sources":["../../../../src/models/data/DataProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataProperty.js","sourceRoot":"","sources":["../../../../src/models/data/DataProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAC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AO,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,kEAAkE;QAClE,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
openapi: '3.0.2'
|
|
2
|
+
info:
|
|
3
|
+
title: OAS dates
|
|
4
|
+
version: '1.0'
|
|
5
|
+
|
|
6
|
+
components:
|
|
7
|
+
schemas:
|
|
8
|
+
DateTypes:
|
|
9
|
+
type: object
|
|
10
|
+
properties:
|
|
11
|
+
dateString: # http://www.w3.org/2001/XMLSchema#date
|
|
12
|
+
type: string
|
|
13
|
+
format: date
|
|
14
|
+
dateTimeString: # http://www.w3.org/2001/XMLSchema#dateTime
|
|
15
|
+
type: string
|
|
16
|
+
format: date-time
|
|
17
|
+
|
|
18
|
+
paths:
|
|
19
|
+
/strings:
|
|
20
|
+
get:
|
|
21
|
+
summary: DateTypes
|
|
22
|
+
responses:
|
|
23
|
+
'200':
|
|
24
|
+
description: DateTypes
|
|
25
|
+
content:
|
|
26
|
+
application/json:
|
|
27
|
+
schema:
|
|
28
|
+
$ref: "#/components/schemas/DateTypes"
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
openapi: '3.0.2'
|
|
2
|
+
info:
|
|
3
|
+
title: OAS types
|
|
4
|
+
version: '1.0'
|
|
5
|
+
description: Different OAS types
|
|
6
|
+
|
|
7
|
+
components:
|
|
8
|
+
schemas:
|
|
9
|
+
NumberTypes:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
simpleNumber:
|
|
13
|
+
type: number
|
|
14
|
+
simpleFloat:
|
|
15
|
+
type: number
|
|
16
|
+
format: float
|
|
17
|
+
simpleDouble:
|
|
18
|
+
type: number
|
|
19
|
+
format: double
|
|
20
|
+
simpleInteger:
|
|
21
|
+
type: integer
|
|
22
|
+
simpleInt32:
|
|
23
|
+
type: integer
|
|
24
|
+
format: int32
|
|
25
|
+
simpleInt64:
|
|
26
|
+
type: integer
|
|
27
|
+
format: int64
|
|
28
|
+
minMaxInteger:
|
|
29
|
+
type: integer
|
|
30
|
+
minimum: 1
|
|
31
|
+
maximum: 20
|
|
32
|
+
exclusiveMinimum: true
|
|
33
|
+
multipleInteger:
|
|
34
|
+
type: integer
|
|
35
|
+
multipleOf: 4
|
|
36
|
+
StringTypes:
|
|
37
|
+
type: object
|
|
38
|
+
properties:
|
|
39
|
+
simpleString:
|
|
40
|
+
type: string
|
|
41
|
+
minMaxString:
|
|
42
|
+
type: string
|
|
43
|
+
minLength: 3
|
|
44
|
+
maxLength: 20
|
|
45
|
+
dateString: # http://www.w3.org/2001/XMLSchema#date
|
|
46
|
+
type: string
|
|
47
|
+
format: date
|
|
48
|
+
dateTimeString: # http://www.w3.org/2001/XMLSchema#dateTime
|
|
49
|
+
type: string
|
|
50
|
+
format: date-time
|
|
51
|
+
passwordString:
|
|
52
|
+
type: string
|
|
53
|
+
format: password
|
|
54
|
+
byteString:
|
|
55
|
+
type: string
|
|
56
|
+
format: byte
|
|
57
|
+
binaryString:
|
|
58
|
+
type: string
|
|
59
|
+
format: binary
|
|
60
|
+
emailString:
|
|
61
|
+
type: string
|
|
62
|
+
format: email
|
|
63
|
+
uuidString:
|
|
64
|
+
type: string
|
|
65
|
+
format: uuid
|
|
66
|
+
uriString:
|
|
67
|
+
type: string
|
|
68
|
+
format: uri
|
|
69
|
+
hostnameString:
|
|
70
|
+
type: string
|
|
71
|
+
format: hostname
|
|
72
|
+
jsonPointerString:
|
|
73
|
+
type: string
|
|
74
|
+
format: json-pointer
|
|
75
|
+
patternString:
|
|
76
|
+
type: string
|
|
77
|
+
pattern: '^\d{3}-\d{2}-\d{4}$'
|
|
78
|
+
enumString:
|
|
79
|
+
type: string
|
|
80
|
+
enum: [asc, desc]
|
|
81
|
+
BooleanTypes:
|
|
82
|
+
type: object
|
|
83
|
+
properties:
|
|
84
|
+
simpleBoolean:
|
|
85
|
+
type: boolean
|
|
86
|
+
defaultBoolean:
|
|
87
|
+
type: boolean
|
|
88
|
+
default: true
|
|
89
|
+
NullableTypes:
|
|
90
|
+
type: object
|
|
91
|
+
properties:
|
|
92
|
+
nullableString:
|
|
93
|
+
type: string
|
|
94
|
+
nullable: true
|
|
95
|
+
nullableEnumString:
|
|
96
|
+
type: string
|
|
97
|
+
nullable: true
|
|
98
|
+
enum: [asc, desc, null]
|
|
99
|
+
FileTypes:
|
|
100
|
+
type: object
|
|
101
|
+
properties:
|
|
102
|
+
binaryFile:
|
|
103
|
+
type: string
|
|
104
|
+
format: binary
|
|
105
|
+
byteString:
|
|
106
|
+
type: string
|
|
107
|
+
format: byte
|
|
108
|
+
|
|
109
|
+
paths:
|
|
110
|
+
/numbers:
|
|
111
|
+
get:
|
|
112
|
+
summary: NumberTypes
|
|
113
|
+
responses:
|
|
114
|
+
'200':
|
|
115
|
+
description: NumberTypes
|
|
116
|
+
content:
|
|
117
|
+
application/json:
|
|
118
|
+
schema:
|
|
119
|
+
$ref: "#/components/schemas/NumberTypes"
|
|
120
|
+
/strings:
|
|
121
|
+
get:
|
|
122
|
+
summary: StringTypes
|
|
123
|
+
responses:
|
|
124
|
+
'200':
|
|
125
|
+
description: StringTypes
|
|
126
|
+
content:
|
|
127
|
+
application/json:
|
|
128
|
+
schema:
|
|
129
|
+
$ref: "#/components/schemas/StringTypes"
|
|
130
|
+
/booleans:
|
|
131
|
+
get:
|
|
132
|
+
summary: BooleanTypes
|
|
133
|
+
responses:
|
|
134
|
+
'200':
|
|
135
|
+
description: BooleanTypes
|
|
136
|
+
content:
|
|
137
|
+
application/json:
|
|
138
|
+
schema:
|
|
139
|
+
$ref: "#/components/schemas/BooleanTypes"
|
|
140
|
+
/nullables:
|
|
141
|
+
get:
|
|
142
|
+
summary: NullableTypes
|
|
143
|
+
responses:
|
|
144
|
+
'200':
|
|
145
|
+
description: NullableTypes
|
|
146
|
+
content:
|
|
147
|
+
application/json:
|
|
148
|
+
schema:
|
|
149
|
+
$ref: "#/components/schemas/NullableTypes"
|
|
150
|
+
/files:
|
|
151
|
+
get:
|
|
152
|
+
summary: FileTypes
|
|
153
|
+
responses:
|
|
154
|
+
'200':
|
|
155
|
+
description: FileTypes
|
|
156
|
+
content:
|
|
157
|
+
application/json:
|
|
158
|
+
schema:
|
|
159
|
+
$ref: "#/components/schemas/FileTypes"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
openapi: '3.0.2'
|
|
2
|
+
info:
|
|
3
|
+
title: OAS unions
|
|
4
|
+
version: '1.0'
|
|
5
|
+
|
|
6
|
+
components:
|
|
7
|
+
schemas:
|
|
8
|
+
Dog:
|
|
9
|
+
type: object
|
|
10
|
+
properties:
|
|
11
|
+
bark:
|
|
12
|
+
type: boolean
|
|
13
|
+
breed:
|
|
14
|
+
type: string
|
|
15
|
+
enum: [Dingo, Husky, Retriever, Shepherd]
|
|
16
|
+
Cat:
|
|
17
|
+
type: object
|
|
18
|
+
properties:
|
|
19
|
+
hunts:
|
|
20
|
+
type: boolean
|
|
21
|
+
age:
|
|
22
|
+
type: integer
|
|
23
|
+
OneOfSchema:
|
|
24
|
+
oneOf:
|
|
25
|
+
- $ref: '#/components/schemas/Cat'
|
|
26
|
+
- $ref: '#/components/schemas/Dog'
|
|
27
|
+
AllOfSchema:
|
|
28
|
+
allOf:
|
|
29
|
+
- $ref: '#/components/schemas/Cat'
|
|
30
|
+
- $ref: '#/components/schemas/Dog'
|
|
31
|
+
AnyOfSchema:
|
|
32
|
+
anyOf:
|
|
33
|
+
- $ref: '#/components/schemas/Cat'
|
|
34
|
+
- $ref: '#/components/schemas/Dog'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
paths:
|
|
38
|
+
/oneOf:
|
|
39
|
+
patch:
|
|
40
|
+
requestBody:
|
|
41
|
+
content:
|
|
42
|
+
application/json:
|
|
43
|
+
schema:
|
|
44
|
+
oneOf:
|
|
45
|
+
- $ref: '#/components/schemas/Cat'
|
|
46
|
+
- $ref: '#/components/schemas/Dog'
|
|
47
|
+
responses:
|
|
48
|
+
'200':
|
|
49
|
+
description: Updated
|
|
50
|
+
/allOf:
|
|
51
|
+
patch:
|
|
52
|
+
requestBody:
|
|
53
|
+
content:
|
|
54
|
+
application/json:
|
|
55
|
+
allOf:
|
|
56
|
+
- $ref: '#/components/schemas/Cat'
|
|
57
|
+
- $ref: '#/components/schemas/Dog'
|
|
58
|
+
discriminator:
|
|
59
|
+
propertyName: pet_type
|
|
60
|
+
responses:
|
|
61
|
+
'200':
|
|
62
|
+
description: Updated
|
|
63
|
+
/anyOf:
|
|
64
|
+
patch:
|
|
65
|
+
requestBody:
|
|
66
|
+
content:
|
|
67
|
+
application/json:
|
|
68
|
+
anyOf:
|
|
69
|
+
- $ref: '#/components/schemas/Cat'
|
|
70
|
+
- $ref: '#/components/schemas/Dog'
|
|
71
|
+
discriminator:
|
|
72
|
+
propertyName: pet_type
|
|
73
|
+
responses:
|
|
74
|
+
'200':
|
|
75
|
+
description: Updated
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
title: OAS dates
|
|
3
|
+
version: v1
|
|
4
|
+
|
|
5
|
+
types:
|
|
6
|
+
DateTypes:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
dateOnly: # http://www.w3.org/2001/XMLSchema#date (OAS for "date")
|
|
10
|
+
type: date-only
|
|
11
|
+
timeOnly: # http://www.w3.org/2001/XMLSchema#time
|
|
12
|
+
type: time-only
|
|
13
|
+
datetimeOnly: # http://a.ml/vocabularies/shapes#dateTimeOnly
|
|
14
|
+
type: datetime-only
|
|
15
|
+
datetimeDefault: # http://www.w3.org/2001/XMLSchema#dateTime (OAS for date-time)
|
|
16
|
+
type: datetime
|
|
17
|
+
datetimeRfc3339: # http://www.w3.org/2001/XMLSchema#dateTime
|
|
18
|
+
type: datetime
|
|
19
|
+
format: rfc3339
|
|
20
|
+
datetimeRfc2616: # http://www.w3.org/2001/XMLSchema#dateTime
|
|
21
|
+
type: datetime
|
|
22
|
+
format: rfc2616
|
|
23
|
+
|
|
24
|
+
/dates:
|
|
25
|
+
post:
|
|
26
|
+
body:
|
|
27
|
+
application/json:
|
|
28
|
+
type: DateTypes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "R34fg663H9KW9MMSKISI",
|
|
3
|
+
"name": "Pawel Psztyc",
|
|
4
|
+
"birthday": "1983-10-20",
|
|
5
|
+
"gender": "male",
|
|
6
|
+
"url": "https://domain.com/profile/pawel.psztyc",
|
|
7
|
+
"image": {
|
|
8
|
+
"url": "https://domain.com/profile/pawel.psztyc/image",
|
|
9
|
+
"thumb": "https://domain.com/profile/pawel.psztyc/image/thumb"
|
|
10
|
+
},
|
|
11
|
+
"tagline": "Some text about me.",
|
|
12
|
+
"language": "en_GB",
|
|
13
|
+
"etag": "W\\244m4n5kj3gbn2nj4k4n4"
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#%RAML 1.0 NamedExample
|
|
2
|
+
|
|
3
|
+
Person exmaple:
|
|
4
|
+
id: R34fg663H9KW9MMSKISI
|
|
5
|
+
name: Pawel Psztyc
|
|
6
|
+
birthday: 1983-10-20
|
|
7
|
+
gender: male
|
|
8
|
+
url: https://domain.com/profile/pawel.psztyc
|
|
9
|
+
image:
|
|
10
|
+
url: https://domain.com/profile/pawel.psztyc/image,
|
|
11
|
+
thumb: https://domain.com/profile/pawel.psztyc/image/thumb
|
|
12
|
+
tagline: Some text about me.
|
|
13
|
+
language: en_GB
|
|
14
|
+
etag: W\\244m4n5kj3gbn2nj4k4n4
|