@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.
Files changed (155) hide show
  1. package/build/browser.d.ts +9 -2
  2. package/build/browser.js +12 -2
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +9 -2
  5. package/build/index.js +12 -2
  6. package/build/index.js.map +1 -1
  7. package/build/src/amf/AmfMixin.d.ts +395 -0
  8. package/build/src/amf/AmfMixin.js +1146 -0
  9. package/build/src/amf/AmfMixin.js.map +1 -0
  10. package/build/src/amf/AmfSerializer.d.ts +136 -0
  11. package/build/src/amf/AmfSerializer.js +1913 -0
  12. package/build/src/amf/AmfSerializer.js.map +1 -0
  13. package/build/src/amf/AmfShapeGenerator.d.ts +85 -0
  14. package/build/src/amf/AmfShapeGenerator.js +385 -0
  15. package/build/src/amf/AmfShapeGenerator.js.map +1 -0
  16. package/build/src/amf/AmfTypes.d.ts +24 -0
  17. package/build/src/amf/AmfTypes.js +122 -0
  18. package/build/src/amf/AmfTypes.js.map +1 -0
  19. package/build/src/amf/ApiExampleGenerator.d.ts +36 -0
  20. package/build/src/amf/ApiExampleGenerator.js +109 -0
  21. package/build/src/amf/ApiExampleGenerator.js.map +1 -0
  22. package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +67 -0
  23. package/build/src/amf/ApiMonacoSchemaGenerator.js +243 -0
  24. package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -0
  25. package/build/src/amf/ApiSchemaGenerator.d.ts +55 -0
  26. package/build/src/amf/ApiSchemaGenerator.js +94 -0
  27. package/build/src/amf/ApiSchemaGenerator.js.map +1 -0
  28. package/build/src/amf/ApiSchemaValues.d.ts +98 -0
  29. package/build/src/amf/ApiSchemaValues.js +382 -0
  30. package/build/src/amf/ApiSchemaValues.js.map +1 -0
  31. package/build/src/amf/Utils.d.ts +41 -0
  32. package/build/src/amf/Utils.js +176 -0
  33. package/build/src/amf/Utils.js.map +1 -0
  34. package/build/src/amf/data-node/DataNodeBase.d.ts +31 -0
  35. package/build/src/amf/data-node/DataNodeBase.js +77 -0
  36. package/build/src/amf/data-node/DataNodeBase.js.map +1 -0
  37. package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +15 -0
  38. package/build/src/amf/data-node/JsonDataNodeGenerator.js +24 -0
  39. package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -0
  40. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +13 -0
  41. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js +42 -0
  42. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -0
  43. package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +21 -0
  44. package/build/src/amf/data-node/XmlDataNodeGenerator.js +30 -0
  45. package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -0
  46. package/build/src/amf/definitions/Amf.d.ts +362 -0
  47. package/build/src/amf/definitions/Amf.js +2 -0
  48. package/build/src/amf/definitions/Amf.js.map +1 -0
  49. package/build/src/amf/definitions/Api.d.ts +381 -0
  50. package/build/src/amf/definitions/Api.js +2 -0
  51. package/build/src/amf/definitions/Api.js.map +1 -0
  52. package/build/src/amf/definitions/Base.d.ts +11 -0
  53. package/build/src/amf/definitions/Base.js +2 -0
  54. package/build/src/amf/definitions/Base.js.map +1 -0
  55. package/build/src/amf/definitions/Namespace.d.ts +311 -0
  56. package/build/src/amf/definitions/Namespace.js +330 -0
  57. package/build/src/amf/definitions/Namespace.js.map +1 -0
  58. package/build/src/amf/definitions/Shapes.d.ts +309 -0
  59. package/build/src/amf/definitions/Shapes.js +87 -0
  60. package/build/src/amf/definitions/Shapes.js.map +1 -0
  61. package/build/src/amf/models/AmfDataNode.d.ts +68 -0
  62. package/build/src/amf/models/AmfDataNode.js +188 -0
  63. package/build/src/amf/models/AmfDataNode.js.map +1 -0
  64. package/build/src/amf/shape/ShapeBase.d.ts +75 -0
  65. package/build/src/amf/shape/ShapeBase.js +90 -0
  66. package/build/src/amf/shape/ShapeBase.js.map +1 -0
  67. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +46 -0
  68. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +406 -0
  69. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -0
  70. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +84 -0
  71. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +820 -0
  72. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -0
  73. package/build/src/models/Thing.d.ts +17 -0
  74. package/build/src/models/Thing.js +19 -1
  75. package/build/src/models/Thing.js.map +1 -1
  76. package/build/src/models/data/Bindings.d.ts +161 -0
  77. package/build/src/models/data/Bindings.js +2 -0
  78. package/build/src/models/data/Bindings.js.map +1 -0
  79. package/build/src/models/data/DataAssociation.d.ts +135 -14
  80. package/build/src/models/data/DataAssociation.js +154 -21
  81. package/build/src/models/data/DataAssociation.js.map +1 -1
  82. package/build/src/models/data/DataAssociationSchema.d.ts +36 -0
  83. package/build/src/models/data/DataEntity.d.ts +76 -4
  84. package/build/src/models/data/DataEntity.js +136 -9
  85. package/build/src/models/data/DataEntity.js.map +1 -1
  86. package/build/src/models/data/DataFile.d.ts +3 -0
  87. package/build/src/models/data/DataFile.js +3 -0
  88. package/build/src/models/data/DataFile.js.map +1 -1
  89. package/build/src/models/data/DataModel.d.ts +1 -1
  90. package/build/src/models/data/DataModel.js.map +1 -1
  91. package/build/src/models/data/DataNamespace.d.ts +6 -0
  92. package/build/src/models/data/DataNamespace.js +11 -1
  93. package/build/src/models/data/DataNamespace.js.map +1 -1
  94. package/build/src/models/data/DataProperty.d.ts +131 -36
  95. package/build/src/models/data/DataProperty.js +200 -17
  96. package/build/src/models/data/DataProperty.js.map +1 -1
  97. package/data/apis/oas-date/oas-date.yaml +28 -0
  98. package/data/apis/oas-types/oas-types.yaml +159 -0
  99. package/data/apis/oas-unions/oas-unions.yaml +75 -0
  100. package/data/apis/raml-date/raml-date.raml +28 -0
  101. package/data/apis/recursive/recursive.raml +14 -0
  102. package/data/apis/schema-api/examples/person.json +14 -0
  103. package/data/apis/schema-api/examples/person.raml +14 -0
  104. package/data/apis/schema-api/examples/person.url.encoded +1 -0
  105. package/data/apis/schema-api/examples/person.xml +14 -0
  106. package/data/apis/schema-api/library/demo-types.raml +43 -0
  107. package/data/apis/schema-api/schema-api.raml +644 -0
  108. package/data/apis/schema-api/schemas/person.json +104 -0
  109. package/data/apis/schema-api/schemas/person.xsd +26 -0
  110. package/data/apis/schema-api/types/DemoPerson.raml +67 -0
  111. package/data/model.js +106 -0
  112. package/data/models/oas-date.json +637 -0
  113. package/data/models/oas-types.json +5352 -0
  114. package/data/models/oas-unions.json +1881 -0
  115. package/data/models/raml-date.json +1096 -0
  116. package/data/models/recursive.json +610 -0
  117. package/data/models/schema-api.json +37319 -0
  118. package/package.json +9 -6
  119. package/src/amf/AmfMixin.ts +1623 -0
  120. package/src/amf/AmfSerializer.ts +2028 -0
  121. package/src/amf/AmfShapeGenerator.ts +400 -0
  122. package/src/amf/AmfTypes.ts +126 -0
  123. package/src/amf/ApiExampleGenerator.ts +112 -0
  124. package/src/amf/ApiMonacoSchemaGenerator.ts +296 -0
  125. package/src/amf/ApiSchemaGenerator.ts +108 -0
  126. package/src/amf/ApiSchemaValues.ts +411 -0
  127. package/src/amf/Utils.ts +182 -0
  128. package/src/amf/data-node/DataNodeBase.ts +81 -0
  129. package/src/amf/data-node/JsonDataNodeGenerator.ts +26 -0
  130. package/src/amf/data-node/README.md +3 -0
  131. package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +43 -0
  132. package/src/amf/data-node/XmlDataNodeGenerator.ts +38 -0
  133. package/src/amf/definitions/Amf.ts +443 -0
  134. package/src/amf/definitions/Api.ts +427 -0
  135. package/src/amf/definitions/Base.ts +13 -0
  136. package/src/amf/definitions/Namespace.ts +341 -0
  137. package/src/amf/definitions/Shapes.ts +414 -0
  138. package/src/amf/models/AmfDataNode.ts +200 -0
  139. package/src/amf/shape/README.md +4 -0
  140. package/src/amf/shape/ShapeBase.ts +160 -0
  141. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +422 -0
  142. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +876 -0
  143. package/src/models/Thing.ts +25 -1
  144. package/src/models/data/Bindings.ts +186 -0
  145. package/src/models/data/DataAssociation.ts +226 -29
  146. package/src/models/data/DataAssociationSchema.ts +38 -0
  147. package/src/models/data/DataEntity.ts +170 -13
  148. package/src/models/data/DataFile.ts +3 -0
  149. package/src/models/data/DataModel.ts +1 -1
  150. package/src/models/data/DataNamespace.ts +16 -1
  151. package/src/models/data/DataProperty.ts +250 -47
  152. package/build/src/models/data/DataPropertySchema.d.ts +0 -125
  153. package/build/src/models/data/DataPropertySchema.js +0 -33
  154. package/build/src/models/data/DataPropertySchema.js.map +0 -1
  155. package/src/models/data/DataPropertySchema.ts +0 -156
@@ -5,6 +5,9 @@ import { DataProperty, DataPropertyType } from "./DataProperty.js";
5
5
  import { DataAssociation } from "./DataAssociation.js";
6
6
  import { IBreadcrumb } from "../store/Breadcrumb.js";
7
7
  import { DataModel } from "./DataModel.js";
8
+ import { INodeShape, IShapeUnion } from "../../amf/definitions/Shapes.js";
9
+ import { AmfShapeGenerator } from "../../amf/AmfShapeGenerator.js";
10
+ import { ApiSchemaGenerator } from "../../amf/ApiSchemaGenerator.js";
8
11
 
9
12
  export const Kind = 'Core#DataEntity';
10
13
 
@@ -55,6 +58,29 @@ export interface IDataEntity {
55
58
  * with inconsistent definition of a schema because the last read property wins.
56
59
  */
57
60
  parents?: string[];
61
+
62
+ /**
63
+ * Whether this entity is deprecated.
64
+ */
65
+ deprecated?: boolean;
66
+
67
+ /**
68
+ * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)
69
+ *
70
+ * Schema limitations:
71
+ *
72
+ * - can only occur on an adapted property. Has no effect on the "main" property.
73
+ */
74
+ schema?: INodeShape;
75
+
76
+ /**
77
+ * The key of the entity that is adapted by this entity.
78
+ * Adapted entities can manipulate the shape of the schema for the entity.
79
+ *
80
+ * Each value defined on the adapted entity changes the original value defined on
81
+ * the entity.
82
+ */
83
+ adapts?: string;
58
84
  }
59
85
 
60
86
  /**
@@ -104,6 +130,20 @@ export class DataEntity {
104
130
  */
105
131
  parents: string[] = [];
106
132
 
133
+ /**
134
+ * Whether this entity is deprecated.
135
+ */
136
+ deprecated?: boolean;
137
+
138
+ /**
139
+ * The key of the entity that is adapted by this entity.
140
+ * Adapted entities can manipulate the shape of the schema for the entity.
141
+ *
142
+ * Each value defined on the adapted entity changes the original value defined on
143
+ * the entity.
144
+ */
145
+ adapts?: string;
146
+
107
147
  static fromName(root: DataNamespace, name: string): DataEntity {
108
148
  const entity = new DataEntity(root);
109
149
  entity.info = Thing.fromName(name);
@@ -113,7 +153,7 @@ export class DataEntity {
113
153
  /**
114
154
  * @param input The data entity definition to restore.
115
155
  */
116
- constructor(protected root: DataNamespace, input?: string | IDataEntity) {
156
+ constructor(public root: DataNamespace, input?: string | IDataEntity) {
117
157
  let init: IDataEntity;
118
158
  if (typeof input === 'string') {
119
159
  init = JSON.parse(input);
@@ -133,7 +173,10 @@ export class DataEntity {
133
173
  if (!DataEntity.isDataEntity(init)) {
134
174
  throw new Error(`Not a data entity.`);
135
175
  }
136
- const { info, key = v4(), kind = Kind, tags, taxonomy, parents, properties, associations } = init;
176
+ const {
177
+ info, key = v4(), kind = Kind, tags, taxonomy, parents, properties, associations,
178
+ deprecated, adapts,
179
+ } = init;
137
180
  this.kind = kind;
138
181
  this.key = key;
139
182
  if (info) {
@@ -141,7 +184,6 @@ export class DataEntity {
141
184
  } else {
142
185
  this.info = Thing.fromName('');
143
186
  }
144
-
145
187
  if (Array.isArray(tags)) {
146
188
  this.tags = [...tags];
147
189
  } else {
@@ -157,7 +199,6 @@ export class DataEntity {
157
199
  } else {
158
200
  this.parents = [];
159
201
  }
160
-
161
202
  this.properties = [];
162
203
  if (Array.isArray(properties)) {
163
204
  properties.forEach(key => {
@@ -167,7 +208,6 @@ export class DataEntity {
167
208
  }
168
209
  });
169
210
  }
170
-
171
211
  this.associations = [];
172
212
  if (Array.isArray(associations)) {
173
213
  associations.forEach(key => {
@@ -177,6 +217,16 @@ export class DataEntity {
177
217
  }
178
218
  });
179
219
  }
220
+ if (typeof deprecated === 'boolean') {
221
+ this.deprecated = deprecated;
222
+ } else {
223
+ this.deprecated = undefined;
224
+ }
225
+ if (typeof adapts === 'string') {
226
+ this.adapts = adapts;
227
+ } else {
228
+ this.adapts = undefined;
229
+ }
180
230
  }
181
231
 
182
232
  static isDataEntity(input: unknown): boolean {
@@ -208,6 +258,12 @@ export class DataEntity {
208
258
  if (Array.isArray(this.associations) && this.associations.length) {
209
259
  result.associations = this.associations.map(i => i.key);
210
260
  }
261
+ if (typeof this.deprecated === 'boolean') {
262
+ result.deprecated = this.deprecated;
263
+ }
264
+ if (this.adapts) {
265
+ result.adapts = this.adapts;
266
+ }
211
267
  return result;
212
268
  }
213
269
 
@@ -224,8 +280,11 @@ export class DataEntity {
224
280
  * @param type The type of the property
225
281
  * @returns The created property
226
282
  */
227
- addTypedProperty(type: DataPropertyType): DataProperty {
283
+ addTypedProperty(type: DataPropertyType, name?: string): DataProperty {
228
284
  const property = DataProperty.fromType(this.root, type);
285
+ if (name) {
286
+ property.info.name = name;
287
+ }
229
288
  this.root.definitions.properties.push(property);
230
289
  this.properties.push(property);
231
290
  return property;
@@ -276,8 +335,11 @@ export class DataEntity {
276
335
  * @param target The target entity key of the association
277
336
  * @returns The created association
278
337
  */
279
- addTargetAssociation(target: string): DataAssociation {
338
+ addTargetAssociation(target: string, name?: string): DataAssociation {
280
339
  const result = DataAssociation.fromTarget(this.root, target);
340
+ if (name) {
341
+ result.info.name = name;
342
+ }
281
343
  this.root.definitions.associations.push(result);
282
344
  this.associations.push(result);
283
345
  return result;
@@ -302,15 +364,18 @@ export class DataEntity {
302
364
  /**
303
365
  * Reads the list of parents for the entity, inside the root namespace. The computed list contains the list of all
304
366
  * parents in the inheritance chain in no particular order.
367
+ * @param recursive Whether to include parent parents as well.
305
368
  */
306
- getComputedParents(): DataEntity[] {
369
+ getComputedParents(recursive?: boolean): DataEntity[] {
307
370
  const { entities } = this.root.definitions;
308
371
  let result: DataEntity[] = [];
309
372
  this.parents.forEach((key) => {
310
373
  const parent = entities.find(i => i.key === key);
311
374
  if (parent) {
312
375
  result.push(parent);
313
- result = result.concat(parent.getComputedParents());
376
+ if (recursive) {
377
+ result = result.concat(parent.getComputedParents());
378
+ }
314
379
  }
315
380
  });
316
381
  return result;
@@ -333,10 +398,10 @@ export class DataEntity {
333
398
  const { entities } = root.definitions;
334
399
  const result: DataEntity[] = [];
335
400
  associations.forEach((assoc) => {
336
- if (!assoc.target) {
401
+ if (!assoc.targets.length) {
337
402
  return;
338
403
  }
339
- const entity = entities.find(i => i.key === assoc.target);
404
+ const entity = entities.find(i => assoc.targets.includes(i.key));
340
405
  if (entity) {
341
406
  result.push(entity);
342
407
  }
@@ -444,7 +509,7 @@ export class DataEntity {
444
509
  const graph: Record<string, string[]> = {};
445
510
  const { associations, entities } = this.root.definitions;
446
511
  for (const assoc of associations) {
447
- if (!assoc.target) {
512
+ if (!assoc.targets.length) {
448
513
  continue;
449
514
  }
450
515
  const srcEntity = entities.find(i => i.associations.some(a => a === assoc));
@@ -454,7 +519,7 @@ export class DataEntity {
454
519
  if (!graph[srcEntity.key]) {
455
520
  graph[srcEntity.key] = [];
456
521
  }
457
- graph[srcEntity.key].push(assoc.target);
522
+ graph[srcEntity.key].splice(0, 0, ...assoc.targets);
458
523
  }
459
524
  return graph;
460
525
  }
@@ -493,4 +558,96 @@ export class DataEntity {
493
558
  });
494
559
  return result.reverse();
495
560
  }
561
+
562
+ /**
563
+ * Adds a new tag to the property. It also populates the root namespace's tags when tag is new.
564
+ *
565
+ * Note, it does nothing when the tag is already defined.
566
+ *
567
+ * @param tag The tag to add.
568
+ */
569
+ addTag(tag: string): void {
570
+ if (!tag) {
571
+ return;
572
+ }
573
+ const lower = tag.toLowerCase();
574
+ const { tags } = this;
575
+ if (tags.some(t => t.toLowerCase() === lower)) {
576
+ return;
577
+ }
578
+ tags.push(tag);
579
+ const { definitions } = this.root;
580
+ if (!definitions.tags.some(t => t.toLowerCase() === lower)) {
581
+ definitions.tags.push(tag);
582
+ }
583
+ }
584
+
585
+ /**
586
+ * Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.
587
+ *
588
+ * @param tag The tag to remove.
589
+ */
590
+ removeTag(tag: string): void {
591
+ if (!tag) {
592
+ return;
593
+ }
594
+ const lower = tag.toLowerCase();
595
+ const { tags } = this;
596
+ const index = tags.findIndex(t => t.toLowerCase() === lower);
597
+ if (index >= 0) {
598
+ tags.splice(index, 1);
599
+ }
600
+ }
601
+
602
+ /**
603
+ * Creates a Shape of AMF.
604
+ * The property itself is auto-generated. If the `schema` is defined then it is used
605
+ * as the `range` of the property. Otherwise basic shape is generated for the range.
606
+ *
607
+ * This is a preferred way of reading the AMF shape as this synchronizes changed
608
+ * data properties with the shape definition.
609
+ *
610
+ * @returns AMF property shape definition.
611
+ */
612
+ toApiShape(): IShapeUnion {
613
+ const serializer = new AmfShapeGenerator();
614
+ return serializer.entity(this);
615
+ }
616
+
617
+ /**
618
+ * Reads the schema of the Entity and generates an example for it.
619
+ */
620
+ toExample(mime: string): string | number | boolean | null | undefined {
621
+ const shape = this.toApiShape();
622
+ const generator = new ApiSchemaGenerator(mime, {
623
+ renderExamples: true,
624
+ renderMocked: true,
625
+ renderOptional: true,
626
+ });
627
+ return generator.generate(shape);
628
+ }
629
+
630
+ /**
631
+ * @returns The adapted entity, if any
632
+ */
633
+ readAdapted(): DataEntity | undefined {
634
+ const { adapts } = this;
635
+ if (!adapts) {
636
+ return undefined;
637
+ }
638
+ return this.root.definitions.entities.find(i => i.key === adapts);
639
+ }
640
+
641
+ /**
642
+ * Creates new adapted entity and associates it with this entity.
643
+ * @returns The instance of the created entity.
644
+ */
645
+ createAdapted(): DataEntity {
646
+ const entity = new DataEntity(this.root);
647
+ // disallow defaults as this would influence the schema generation
648
+ entity.info.name = undefined;
649
+ this.root.definitions.entities.push(entity);
650
+ this.adapts = entity.key;
651
+ return entity;
652
+ }
496
653
  }
@@ -9,6 +9,9 @@ export interface IDataFile extends IFile {
9
9
  kind: typeof Kind;
10
10
  }
11
11
 
12
+ /**
13
+ * Used by the store. A file definition for the DataNamespace
14
+ */
12
15
  export class DataFile extends File {
13
16
  kind = Kind;
14
17
 
@@ -59,7 +59,7 @@ export class DataModel {
59
59
  * @param root the root namespace.
60
60
  * @param input The data model definition to restore.
61
61
  */
62
- constructor(protected root: DataNamespace, input?: string | IDataModel) {
62
+ constructor(public root: DataNamespace, input?: string | IDataModel) {
63
63
  let init: IDataModel;
64
64
  if (typeof input === 'string') {
65
65
  init = JSON.parse(input);
@@ -14,6 +14,7 @@ interface IDataDefinitions {
14
14
  properties?: IDataProperty[];
15
15
  associations?: IDataAssociation[];
16
16
  namespaces?: IDataNamespace[];
17
+ tags?: string[];
17
18
  }
18
19
 
19
20
  interface DataDefinitions {
@@ -22,6 +23,11 @@ interface DataDefinitions {
22
23
  properties: DataProperty[];
23
24
  associations: DataAssociation[];
24
25
  namespaces: DataNamespace[];
26
+ /**
27
+ * Common for the entire root namespace tags.
28
+ * These are kept separately so the UI can generate autocomplete for tags.
29
+ */
30
+ tags: string[];
25
31
  }
26
32
 
27
33
  interface IDataNamespaceParent {
@@ -289,6 +295,7 @@ export class DataNamespace extends DataNamespaceParent {
289
295
  entities: [],
290
296
  properties: [],
291
297
  namespaces: [],
298
+ tags: [],
292
299
  };
293
300
  }
294
301
 
@@ -359,6 +366,11 @@ export class DataNamespace extends DataNamespaceParent {
359
366
  } else {
360
367
  this.definitions.namespaces = [];
361
368
  }
369
+ if (Array.isArray(definitions.tags)) {
370
+ this.definitions.tags = [...definitions.tags];
371
+ } else {
372
+ this.definitions.tags = [];
373
+ }
362
374
  }
363
375
 
364
376
  toJSON(): IDataNamespace {
@@ -369,7 +381,7 @@ export class DataNamespace extends DataNamespaceParent {
369
381
  items: this.items.map(i => i.toJSON()),
370
382
  definitions: {},
371
383
  };
372
- const { associations, entities, models, namespaces, properties } = this.definitions;
384
+ const { associations, entities, models, namespaces, properties, tags } = this.definitions;
373
385
  if (Array.isArray(associations) && associations.length) {
374
386
  result.definitions.associations = associations.map(i => i.toJSON());
375
387
  }
@@ -385,6 +397,9 @@ export class DataNamespace extends DataNamespaceParent {
385
397
  if (Array.isArray(properties) && properties.length) {
386
398
  result.definitions.properties = properties.map(i => i.toJSON());
387
399
  }
400
+ if (Array.isArray(tags) && tags.length) {
401
+ result.definitions.tags = [...tags];
402
+ }
388
403
  return result;
389
404
  }
390
405