@api-client/core 0.6.14 → 0.6.17
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/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 +71 -15
- package/build/src/models/data/DataEntity.js +133 -53
- 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 +14 -0
- package/build/src/models/data/DataNamespace.js +50 -0
- package/build/src/models/data/DataNamespace.js.map +1 -1
- package/build/src/models/data/DataProperty.d.ts +107 -36
- package/build/src/models/data/DataProperty.js +147 -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/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 +162 -60
- package/src/models/data/DataFile.ts +3 -0
- package/src/models/data/DataModel.ts +1 -1
- package/src/models/data/DataNamespace.ts +54 -0
- package/src/models/data/DataProperty.ts +191 -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,42 +1,34 @@
|
|
|
1
1
|
import { IThing, Thing } from "../Thing.js";
|
|
2
2
|
import { DataNamespace } from "./DataNamespace.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { IPropertyShape } from "../../amf/definitions/Shapes.js";
|
|
4
|
+
import { IPropertyBindings, IPropertySchema } from './Bindings.js';
|
|
5
|
+
export declare type DataPropertyType = 'string' | 'number' | 'integer' | 'nil' | 'boolean' | 'date' | 'datetime' | 'time' | 'any' | 'binary';
|
|
5
6
|
export declare const DataPropertyTypes: DataPropertyType[];
|
|
6
7
|
export declare enum DataPropertyList {
|
|
7
8
|
string = "string",
|
|
8
9
|
number = "number",
|
|
10
|
+
integer = "integer",
|
|
9
11
|
nil = "nil",
|
|
10
12
|
boolean = "boolean",
|
|
11
13
|
date = "date",
|
|
12
14
|
datetime = "datetime",
|
|
13
15
|
time = "time",
|
|
14
|
-
bytes = "bytes",
|
|
15
16
|
any = "any",
|
|
16
|
-
file = "
|
|
17
|
+
file = "binary"
|
|
17
18
|
}
|
|
18
|
-
export declare
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
* Whether it is a general schema for the property.
|
|
22
|
-
* All other schemas inherit from this one. This allows creating global schema description
|
|
23
|
-
* like examples, default values, minimum value, etc and then use it as a base to generate specific formats.
|
|
24
|
-
*
|
|
25
|
-
* A property may not have a global schema.
|
|
26
|
-
*/
|
|
27
|
-
global?: boolean;
|
|
19
|
+
export declare type DateFormat = 'rfc3339' | 'rfc2616';
|
|
20
|
+
export declare const DateFormats: DateFormat[];
|
|
21
|
+
export declare enum DateFormatList {
|
|
28
22
|
/**
|
|
29
|
-
* The
|
|
30
|
-
* For JSON it is `application/json`, for XML it is `application/xml` (or `text/xml`) adn so on.
|
|
31
|
-
*
|
|
32
|
-
* Note, when this value is missing then it is assumed that the schema is `global`.
|
|
23
|
+
* The "date-time" notation of RFC3339
|
|
33
24
|
*/
|
|
34
|
-
|
|
25
|
+
rfc3339 = "rfc3339",
|
|
35
26
|
/**
|
|
36
|
-
* The
|
|
27
|
+
* The format defined in RFC2616.
|
|
37
28
|
*/
|
|
38
|
-
|
|
29
|
+
rfc2616 = "rfc2616"
|
|
39
30
|
}
|
|
31
|
+
export declare const Kind = "Core#DataProperty";
|
|
40
32
|
export interface IDataProperty {
|
|
41
33
|
kind: typeof Kind;
|
|
42
34
|
/**
|
|
@@ -63,6 +55,21 @@ export interface IDataProperty {
|
|
|
63
55
|
* Whether this property describes an indexed property of the entity.
|
|
64
56
|
*/
|
|
65
57
|
index?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the property is read only in the schema.
|
|
60
|
+
*/
|
|
61
|
+
readOnly?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the property is write only in the schema.
|
|
64
|
+
*/
|
|
65
|
+
writeOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the attribute is hidden in the schema (not a part of it).
|
|
68
|
+
*
|
|
69
|
+
* The hidden attribute should only appear in the adapted attribute.
|
|
70
|
+
* Has no effect when added to the "main" attribute.
|
|
71
|
+
*/
|
|
72
|
+
hidden?: boolean;
|
|
66
73
|
/**
|
|
67
74
|
* Whether this property is deprecated.
|
|
68
75
|
*/
|
|
@@ -86,17 +93,32 @@ export interface IDataProperty {
|
|
|
86
93
|
*/
|
|
87
94
|
type: DataPropertyType;
|
|
88
95
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
96
|
+
* The general schema definition of this property.
|
|
97
|
+
* This is propagated to all bindings (when they support these properties).
|
|
98
|
+
*
|
|
99
|
+
* Note, schema can only occur on an adapted property. Has no effect on the "main"
|
|
100
|
+
* property.
|
|
101
|
+
*/
|
|
102
|
+
schema?: IPropertySchema;
|
|
103
|
+
/**
|
|
104
|
+
* The list of bindings for this property.
|
|
105
|
+
*
|
|
106
|
+
* A binding defines a translation from a data model to a specific format.
|
|
107
|
+
* For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs
|
|
108
|
+
* or a protocol buffer schema.
|
|
95
109
|
*/
|
|
96
|
-
|
|
110
|
+
bindings?: IPropertyBindings[];
|
|
111
|
+
/**
|
|
112
|
+
* The key of the property that is adapted by this property.
|
|
113
|
+
* Adapted properties can manipulate the shape of the schema for the property.
|
|
114
|
+
*
|
|
115
|
+
* Each value defined on the adapted property changes the original value defined on
|
|
116
|
+
* the property.
|
|
117
|
+
*/
|
|
118
|
+
adapts?: string;
|
|
97
119
|
}
|
|
98
120
|
export declare class DataProperty {
|
|
99
|
-
|
|
121
|
+
root: DataNamespace;
|
|
100
122
|
kind: string;
|
|
101
123
|
key: string;
|
|
102
124
|
/**
|
|
@@ -119,6 +141,20 @@ export declare class DataProperty {
|
|
|
119
141
|
* Whether this property describes an indexed property of the entity.
|
|
120
142
|
*/
|
|
121
143
|
index?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether the property is read only in the schema.
|
|
146
|
+
*/
|
|
147
|
+
readOnly?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Whether the property is write only in the schema.
|
|
150
|
+
*/
|
|
151
|
+
writeOnly?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether the attribute is hidden in the schema (not a part of it).
|
|
154
|
+
* The hidden attribute should only appear in the adapted attribute.
|
|
155
|
+
* Has no effect when added to the "main" attribute.
|
|
156
|
+
*/
|
|
157
|
+
hidden?: boolean;
|
|
122
158
|
/**
|
|
123
159
|
* Whether this property is deprecated.
|
|
124
160
|
*/
|
|
@@ -144,14 +180,29 @@ export declare class DataProperty {
|
|
|
144
180
|
*/
|
|
145
181
|
type: DataPropertyType;
|
|
146
182
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
|
|
183
|
+
* The general schema definition of this property.
|
|
184
|
+
* This is propagated to all bindings (when they support these properties).
|
|
185
|
+
*
|
|
186
|
+
* Note, schema can only occur on an adapted property. Has no effect on the "main"
|
|
187
|
+
* property.
|
|
188
|
+
*/
|
|
189
|
+
schema?: IPropertySchema;
|
|
190
|
+
/**
|
|
191
|
+
* The list of bindings for this property.
|
|
192
|
+
*
|
|
193
|
+
* A binding defines a translation from a data model to a specific format.
|
|
194
|
+
* For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs
|
|
195
|
+
* or a protocol buffer schema.
|
|
196
|
+
*/
|
|
197
|
+
bindings: IPropertyBindings[];
|
|
198
|
+
/**
|
|
199
|
+
* The key of the property that is adapted by this property.
|
|
200
|
+
* Adapted properties can manipulate the shape of the schema for the property.
|
|
201
|
+
*
|
|
202
|
+
* Each value defined on the adapted property changes the original value defined on
|
|
203
|
+
* the property.
|
|
153
204
|
*/
|
|
154
|
-
|
|
205
|
+
adapts?: string;
|
|
155
206
|
static get supportedTypes(): DataPropertyType[];
|
|
156
207
|
static fromName(root: DataNamespace, name: string): DataProperty;
|
|
157
208
|
static fromType(root: DataNamespace, type: DataPropertyType): DataProperty;
|
|
@@ -180,4 +231,24 @@ export declare class DataProperty {
|
|
|
180
231
|
* @param tag The tag to remove.
|
|
181
232
|
*/
|
|
182
233
|
removeTag(tag: string): void;
|
|
234
|
+
/**
|
|
235
|
+
* Creates a Property Shape of AMF.
|
|
236
|
+
* The property itself is auto-generated. If the `schema` is defined then it is used
|
|
237
|
+
* as the `range` of the property. Otherwise basic shape is generated for the range.
|
|
238
|
+
*
|
|
239
|
+
* This is a preferred way of reading the AMF shape as this synchronizes changed
|
|
240
|
+
* data properties with the shape definition.
|
|
241
|
+
*
|
|
242
|
+
* @returns AMF property shape definition.
|
|
243
|
+
*/
|
|
244
|
+
toApiShape(): IPropertyShape;
|
|
245
|
+
/**
|
|
246
|
+
* @returns The adapted property, if any
|
|
247
|
+
*/
|
|
248
|
+
readAdapted(): DataProperty | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Creates new adapted property and associates it with this property.
|
|
251
|
+
* @returns The instance of the created property.
|
|
252
|
+
*/
|
|
253
|
+
createAdapted(): DataProperty;
|
|
183
254
|
}
|
|
@@ -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,6 +55,20 @@ 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;
|
|
44
72
|
/**
|
|
45
73
|
* Whether this property is deprecated.
|
|
46
74
|
*/
|
|
@@ -66,14 +94,29 @@ export class DataProperty {
|
|
|
66
94
|
*/
|
|
67
95
|
type = 'string';
|
|
68
96
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
|
|
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.
|
|
75
118
|
*/
|
|
76
|
-
|
|
119
|
+
adapts;
|
|
77
120
|
static get supportedTypes() {
|
|
78
121
|
return [...DataPropertyTypes];
|
|
79
122
|
}
|
|
@@ -113,7 +156,7 @@ export class DataProperty {
|
|
|
113
156
|
if (!DataProperty.isDataProperty(init)) {
|
|
114
157
|
throw new Error(`Not a data property.`);
|
|
115
158
|
}
|
|
116
|
-
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;
|
|
117
160
|
this.kind = kind;
|
|
118
161
|
this.key = key;
|
|
119
162
|
this.type = type;
|
|
@@ -153,6 +196,30 @@ export class DataProperty {
|
|
|
153
196
|
else {
|
|
154
197
|
this.primary = undefined;
|
|
155
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
|
+
}
|
|
156
223
|
if (Array.isArray(tags)) {
|
|
157
224
|
this.tags = [...tags];
|
|
158
225
|
}
|
|
@@ -165,11 +232,17 @@ export class DataProperty {
|
|
|
165
232
|
else {
|
|
166
233
|
this.taxonomy = [];
|
|
167
234
|
}
|
|
168
|
-
if (
|
|
169
|
-
this.
|
|
235
|
+
if (schema) {
|
|
236
|
+
this.schema = JsonCore.clone(schema);
|
|
170
237
|
}
|
|
171
238
|
else {
|
|
172
|
-
this.
|
|
239
|
+
this.schema = undefined;
|
|
240
|
+
}
|
|
241
|
+
if (Array.isArray(bindings)) {
|
|
242
|
+
this.bindings = bindings.map(i => JsonCore.clone(i));
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.bindings = [];
|
|
173
246
|
}
|
|
174
247
|
}
|
|
175
248
|
static isDataProperty(input) {
|
|
@@ -201,14 +274,29 @@ export class DataProperty {
|
|
|
201
274
|
if (typeof this.required === 'boolean') {
|
|
202
275
|
result.required = this.required;
|
|
203
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
|
+
}
|
|
204
289
|
if (Array.isArray(this.tags) && this.tags.length) {
|
|
205
290
|
result.tags = [...this.tags];
|
|
206
291
|
}
|
|
207
292
|
if (Array.isArray(this.taxonomy) && this.taxonomy.length) {
|
|
208
293
|
result.taxonomy = [...this.taxonomy];
|
|
209
294
|
}
|
|
210
|
-
if (
|
|
211
|
-
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));
|
|
212
300
|
}
|
|
213
301
|
return result;
|
|
214
302
|
}
|
|
@@ -216,7 +304,7 @@ export class DataProperty {
|
|
|
216
304
|
* Removes self from the parent entity and the namespace definition.
|
|
217
305
|
*/
|
|
218
306
|
remove() {
|
|
219
|
-
const { root } = this;
|
|
307
|
+
const { root, adapts } = this;
|
|
220
308
|
const entity = root.definitions.entities.find(i => i.properties.some(j => j === this));
|
|
221
309
|
if (entity) {
|
|
222
310
|
const assocIndex = entity.properties.findIndex(i => i === this);
|
|
@@ -226,6 +314,12 @@ export class DataProperty {
|
|
|
226
314
|
if (defIndex >= 0) {
|
|
227
315
|
this.root.definitions.properties.splice(defIndex, 1);
|
|
228
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
|
+
}
|
|
229
323
|
}
|
|
230
324
|
/**
|
|
231
325
|
* Adds a new tag to the property. It also populates the root namespace's tags when tag is new.
|
|
@@ -265,5 +359,41 @@ export class DataProperty {
|
|
|
265
359
|
tags.splice(index, 1);
|
|
266
360
|
}
|
|
267
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;
|
|
397
|
+
}
|
|
268
398
|
}
|
|
269
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;AAC5C,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAInE,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAG,KAAK,EAAE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,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"
|