@api-client/core 0.7.11 → 0.8.0

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 (97) hide show
  1. package/SECURITY.md +14 -0
  2. package/build/browser.d.ts +6 -0
  3. package/build/browser.js +6 -0
  4. package/build/browser.js.map +1 -1
  5. package/build/index.d.ts +6 -0
  6. package/build/index.js +6 -0
  7. package/build/index.js.map +1 -1
  8. package/build/src/amf/AmfMixin.d.ts +55 -42
  9. package/build/src/amf/AmfMixin.js +9 -3
  10. package/build/src/amf/AmfMixin.js.map +1 -1
  11. package/build/src/amf/AmfSerializer.d.ts +72 -72
  12. package/build/src/amf/AmfSerializer.js +9 -4
  13. package/build/src/amf/AmfSerializer.js.map +1 -1
  14. package/build/src/amf/AmfShapeGenerator.d.ts +17 -17
  15. package/build/src/amf/AmfShapeGenerator.js +4 -4
  16. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  17. package/build/src/amf/AmfTypes.d.ts +16 -16
  18. package/build/src/amf/AmfTypes.js +16 -16
  19. package/build/src/amf/AmfTypes.js.map +1 -1
  20. package/build/src/amf/ApiExampleGenerator.d.ts +3 -3
  21. package/build/src/amf/ApiExampleGenerator.js.map +1 -1
  22. package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +6 -6
  23. package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -1
  24. package/build/src/amf/ApiSchemaGenerator.d.ts +2 -2
  25. package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
  26. package/build/src/amf/ApiSchemaValues.d.ts +12 -12
  27. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  28. package/build/src/amf/Parsing.d.ts +5 -5
  29. package/build/src/amf/Utils.d.ts +6 -6
  30. package/build/src/amf/Utils.js.map +1 -1
  31. package/build/src/amf/data-node/DataNodeBase.d.ts +5 -5
  32. package/build/src/amf/data-node/DataNodeBase.js.map +1 -1
  33. package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +2 -2
  34. package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -1
  35. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +2 -2
  36. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -1
  37. package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +2 -2
  38. package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -1
  39. package/build/src/amf/definitions/Amf.d.ts +339 -339
  40. package/build/src/amf/definitions/Api.d.ts +158 -158
  41. package/build/src/amf/definitions/Base.d.ts +5 -5
  42. package/build/src/amf/definitions/Shapes.d.ts +46 -46
  43. package/build/src/amf/definitions/Shapes.js +11 -11
  44. package/build/src/amf/definitions/Shapes.js.map +1 -1
  45. package/build/src/amf/models/AmfDataNode.d.ts +5 -5
  46. package/build/src/amf/models/AmfDataNode.js +4 -4
  47. package/build/src/amf/models/AmfDataNode.js.map +1 -1
  48. package/build/src/amf/shape/ShapeBase.d.ts +13 -13
  49. package/build/src/amf/shape/ShapeBase.js.map +1 -1
  50. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +13 -13
  51. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
  52. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +16 -16
  53. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +1 -1
  54. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
  55. package/build/src/events/amf/AmfEvents.d.ts +4 -4
  56. package/build/src/events/amf/AmfEvents.js.map +1 -1
  57. package/build/src/models/data/Bindings.d.ts +2 -2
  58. package/build/src/models/data/DataAssociation.d.ts +4 -4
  59. package/build/src/models/data/DataAssociation.js.map +1 -1
  60. package/build/src/models/data/DataEntity.d.ts +2 -2
  61. package/build/src/models/data/DataProperty.d.ts +2 -2
  62. package/build/src/runtime/variables/VariablesProcessor.js.map +1 -1
  63. package/data/models/oas-date.json +1 -1
  64. package/data/models/oas-types.json +1 -1
  65. package/data/models/oas-unions.json +1 -1
  66. package/data/models/raml-date.json +1 -1
  67. package/data/models/recursive.json +1 -1
  68. package/data/models/schema-api.json +14 -6
  69. package/package.json +6 -6
  70. package/src/amf/AmfMixin.ts +124 -117
  71. package/src/amf/AmfSerializer.ts +245 -240
  72. package/src/amf/AmfShapeGenerator.ts +24 -24
  73. package/src/amf/AmfTypes.ts +16 -16
  74. package/src/amf/ApiExampleGenerator.ts +4 -4
  75. package/src/amf/ApiMonacoSchemaGenerator.ts +11 -11
  76. package/src/amf/ApiSchemaGenerator.ts +3 -3
  77. package/src/amf/ApiSchemaValues.ts +21 -21
  78. package/src/amf/Parsing.ts +5 -5
  79. package/src/amf/Utils.ts +15 -15
  80. package/src/amf/data-node/DataNodeBase.ts +8 -8
  81. package/src/amf/data-node/JsonDataNodeGenerator.ts +2 -2
  82. package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +2 -2
  83. package/src/amf/data-node/XmlDataNodeGenerator.ts +2 -2
  84. package/src/amf/definitions/Amf.ts +315 -314
  85. package/src/amf/definitions/Api.ts +158 -157
  86. package/src/amf/definitions/Base.ts +5 -5
  87. package/src/amf/definitions/Shapes.ts +60 -60
  88. package/src/amf/models/AmfDataNode.ts +17 -17
  89. package/src/amf/shape/ShapeBase.ts +16 -16
  90. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +27 -27
  91. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +44 -44
  92. package/src/events/amf/AmfEvents.ts +7 -7
  93. package/src/models/data/Bindings.ts +2 -2
  94. package/src/models/data/DataAssociation.ts +4 -4
  95. package/src/models/data/DataEntity.ts +2 -2
  96. package/src/models/data/DataProperty.ts +2 -2
  97. package/src/runtime/variables/VariablesProcessor.ts +2 -2
@@ -1,9 +1,9 @@
1
1
  import { AmfMixin, expandKey, findAmfType, getArrayItems } from "./AmfMixin.js";
2
- import { AnyShape, Api, ArrayNode, ArrayShape, AsyncApi, CreativeWork, DataArrangeShape, DataNode, DocumentSourceMaps, DomainElement, EndPoint, Example, FileShape, License, NodeShape, ObjectNode, Operation, Organization, Parameter, PropertyShape, RecursiveShape, ScalarNode, ScalarShape, SchemaShape, SecurityRequirement, Server, Shape, SynthesizedField, TupleShape, UnionShape, WebApi, XMLSerializer, Payload, Tag, Callback, Request, Response, TemplatedLink, IriTemplateMapping, ParametrizedSecurityScheme, SecurityScheme, Settings, OAuth1Settings, OAuth2Settings, ApiKeySettings, HttpSettings, OpenIdConnectSettings, OAuth2Flow, Scope, ParametrizedDeclaration, ParametrizedTrait, ParametrizedResourceType, VariableValue, AbstractDeclaration } from "./definitions/Amf.js";
3
- import { ApiAbstractDeclaration, ApiAsync, ApiBase, ApiCallback, ApiDocumentation, ApiDocumentSourceMaps, ApiEndPoint, ApiEndPointWithOperationsListItem, ApiIriTemplateMapping, ApiLicense, ApiOperation, ApiOperationListItem, ApiOrganization, ApiParameter, ApiParametrizedDeclaration, ApiParametrizedResourceType, ApiParametrizedSecurityScheme, ApiParametrizedTrait, ApiPayload, ApiRequest, ApiResponse, ApiSecurityApiKeySettings, ApiSecurityHttpSettings, ApiSecurityOAuth1Settings, ApiSecurityOAuth2Flow, ApiSecurityOAuth2Settings, ApiSecurityOpenIdConnectSettings, ApiSecurityRequirement, ApiSecurityScheme, ApiSecuritySchemeListItem, ApiSecurityScope, ApiSecuritySettings, ApiSecuritySettingsUnion, ApiServer, ApiSummary, ApiSynthesizedField, ApiTag, ApiTemplatedLink, ApiVariableValue, ApiWeb, ShapeProcessingOptions } from "./definitions/Api.js";
4
- import { ICustomDomainProperty } from "./definitions/Base.js";
2
+ import { IAmfAnyShape, IAmfApi, IAmfArrayNode, IAmfArrayShape, IAmfAsyncApi, IAmfCreativeWork, IAmfDataArrangeShape, IAmfDataNode, IAmfDocumentSourceMaps, IAmfDomainElement, IAmfEndPoint, IAmfExample, IAmfFileShape, IAmfLicense, IAmfNodeShape, IAmfObjectNode, IAmfOperation, IAmfOrganization, IAmfParameter, IAmfPropertyShape, IAmfRecursiveShape, IAmfScalarNode, IAmfScalarShape, IAmfSchemaShape, IAmfSecurityRequirement, IAmfServer, IAmfShape, IAmfSynthesizedField, IAmfTupleShape, IAmfUnionShape, IAmfWebApi, IAmfXMLSerializer, IAmfPayload, IAmfTag, IAmfCallback, IAmfRequest, IAmfResponse, IAmfTemplatedLink, IAmfIriTemplateMapping, IAmfParametrizedSecurityScheme, IAmfSecurityScheme, IAmfSettings, IAmfOAuth1Settings, IAmfOAuth2Settings, IAmfApiKeySettings, IAmfHttpSettings, IAmfOpenIdConnectSettings, IAmfOAuth2Flow, IAmfScope, IAmfParametrizedDeclaration, IAmfParametrizedTrait, IAmfParametrizedResourceType, IAmfVariableValue, IAmfAbstractDeclaration } from "./definitions/Amf.js";
3
+ import { IApiAbstractDeclaration, IApiAsync, IApiBase, IApiCallback, IApiDocumentation, IApiDocumentSourceMaps, IApiEndPoint, IApiEndPointWithOperationsListItem, IApiIriTemplateMapping, IApiLicense, IApiOperation, IApiOperationListItem, IApiOrganization, IApiParameter, IApiParametrizedDeclaration, IApiParametrizedResourceType, IApiParametrizedSecurityScheme, IApiParametrizedTrait, IApiPayload, IApiRequest, IApiResponse, IApiSecurityApiKeySettings, IApiSecurityHttpSettings, IApiSecurityOAuth1Settings, IApiSecurityOAuth2Flow, IApiSecurityOAuth2Settings, IApiSecurityOpenIdConnectSettings, IApiSecurityRequirement, IApiSecurityScheme, IApiSecuritySchemeListItem, IApiSecurityScope, IApiSecuritySettings, IApiSecuritySettingsUnion, IApiServer, IApiSummary, IApiSynthesizedField, IApiTag, IApiTemplatedLink, IApiVariableValue, IApiWeb, IShapeProcessingOptions } from "./definitions/Api.js";
4
+ import { IApiCustomDomainProperty } from "./definitions/Base.js";
5
5
  import { AmfNamespace as ns } from './definitions/Namespace.js';
6
- import { IAnyShape, IArrayNode, IArrayShape, IDataArrangeShape, IDataExample, IDataNode, IDataNodeUnion, IFileShape, INodeShape, IObjectNode, IPropertyShape, IRecursiveShape, IScalarNode, IScalarShape, ISchemaShape, IShape, IShapeUnion, ITupleShape, IUnionShape, IXmlSerializer } from "./definitions/Shapes.js";
6
+ import { IApiAnyShape, IApiArrayNode, IApiArrayShape, IApiDataArrangeShape, IApiDataExample, IApiDataNode, IApiDataNodeUnion, IApiFileShape, IApiNodeShape, IApiObjectNode, IApiPropertyShape, IApiRecursiveShape, IApiScalarNode, IApiScalarShape, IApiSchemaShape, IApiShape, IShapeUnion, IApiTupleShape, IApiUnionShape, IApiXmlSerializer } from "./definitions/Shapes.js";
7
7
 
8
8
  /**
9
9
  * A class that takes AMF's ld+json model and outputs JavaScript interface of it.
@@ -12,7 +12,7 @@ export class AmfSerializer extends AmfMixin(Object) {
12
12
  /**
13
13
  * @param graph Optional AMF generated graph model.
14
14
  */
15
- constructor(graph?: DomainElement) {
15
+ constructor(graph?: IAmfDomainElement) {
16
16
  super();
17
17
  if (graph) {
18
18
  this.amf = graph;
@@ -38,9 +38,9 @@ export class AmfSerializer extends AmfMixin(Object) {
38
38
  * @param object The API to serialize.
39
39
  * @returns API summary, without complex objects.
40
40
  */
41
- apiSummary(object: Api): ApiSummary {
41
+ apiSummary(object: IAmfApi): IApiSummary {
42
42
  const context = object['@context'];
43
- const result: ApiSummary = {
43
+ const result: IApiSummary = {
44
44
  id: object['@id'],
45
45
  types: this.readTypes(object['@type'], context),
46
46
  customDomainProperties: this.customDomainProperties(object, context),
@@ -68,76 +68,76 @@ export class AmfSerializer extends AmfMixin(Object) {
68
68
  if (termsOfService && typeof termsOfService === 'string') {
69
69
  result.termsOfService = termsOfService;
70
70
  }
71
- const accepts = object[this._getAmfKey(ns.aml.vocabularies.apiContract.accepts, context) as keyof Api] as any;
71
+ const accepts = object[this._getAmfKey(ns.aml.vocabularies.apiContract.accepts, context) as keyof IAmfApi] as any;
72
72
  if (Array.isArray(accepts) && accepts.length) {
73
73
  result.accepts = this._getValueArray(object, ns.aml.vocabularies.apiContract.accepts, context) as string[];
74
74
  }
75
- const contentType = object[this._getAmfKey(ns.aml.vocabularies.apiContract.contentType, context) as keyof Api];
75
+ const contentType = object[this._getAmfKey(ns.aml.vocabularies.apiContract.contentType, context) as keyof IAmfApi];
76
76
  if (Array.isArray(contentType) && contentType.length) {
77
77
  result.contentType = this._getValueArray(object, ns.aml.vocabularies.apiContract.contentType, context) as string[];
78
78
  }
79
- const schemes = object[this._getAmfKey(ns.aml.vocabularies.apiContract.scheme, context) as keyof Api];
79
+ const schemes = object[this._getAmfKey(ns.aml.vocabularies.apiContract.scheme, context) as keyof IAmfApi];
80
80
  if (Array.isArray(schemes) && schemes.length) {
81
81
  result.schemes = this._getValueArray(object, ns.aml.vocabularies.apiContract.scheme, context) as string[];
82
82
  }
83
- let provider = object[this._getAmfKey(ns.aml.vocabularies.core.provider, context) as keyof Api] as Organization[] | Organization;
83
+ let provider = object[this._getAmfKey(ns.aml.vocabularies.core.provider, context) as keyof IAmfApi] as IAmfOrganization[] | IAmfOrganization;
84
84
  if (Array.isArray(provider)) {
85
85
  [provider] = provider;
86
86
  }
87
87
  if (provider) {
88
88
  result.provider = this.provider(provider);
89
89
  }
90
- let license = object[this._getAmfKey(ns.aml.vocabularies.core.license, context) as keyof Api] as License | License[];
90
+ let license = object[this._getAmfKey(ns.aml.vocabularies.core.license, context) as keyof IAmfApi] as IAmfLicense | IAmfLicense[];
91
91
  if (Array.isArray(license)) {
92
92
  [license] = license;
93
93
  }
94
94
  if (license) {
95
95
  result.license = this.license(license);
96
96
  }
97
- const tags = object[this._getAmfKey(ns.aml.vocabularies.apiContract.tag, context) as keyof Api] as Tag[] | undefined;
97
+ const tags = object[this._getAmfKey(ns.aml.vocabularies.apiContract.tag, context) as keyof IAmfApi] as IAmfTag[] | undefined;
98
98
  if (Array.isArray(tags) && tags.length) {
99
99
  result.tags = tags.map(t => this.tag(t));
100
100
  }
101
- const docs = object[this._getAmfKey(ns.aml.vocabularies.core.documentation, context) as keyof Api] as CreativeWork[] | undefined;
101
+ const docs = object[this._getAmfKey(ns.aml.vocabularies.core.documentation, context) as keyof IAmfApi] as IAmfCreativeWork[] | undefined;
102
102
  if (Array.isArray(docs) && docs.length) {
103
103
  result.documentations = docs.map(d => this.documentation(d));
104
104
  }
105
105
  return result;
106
106
  }
107
107
 
108
- api(object: Api, context?: Record<string, string>): ApiBase {
108
+ api(object: IAmfApi, context?: Record<string, string>): IApiBase {
109
109
  const objectContext = context || object['@context'];
110
- const result = this.apiSummary(object) as ApiBase;
110
+ const result = this.apiSummary(object) as IApiBase;
111
111
  result.endPoints = [];
112
112
  result.servers = [];
113
113
  result.security = [];
114
114
 
115
- const endPoints = object[this._getAmfKey(ns.aml.vocabularies.apiContract.endpoint, objectContext) as keyof Api] as EndPoint[] | undefined;
115
+ const endPoints = object[this._getAmfKey(ns.aml.vocabularies.apiContract.endpoint, objectContext) as keyof IAmfApi] as IAmfEndPoint[] | undefined;
116
116
  if (Array.isArray(endPoints) && endPoints.length) {
117
117
  result.endPoints = endPoints.map(e => this.endPoint(e, objectContext));
118
118
  }
119
- const servers = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof Api] as Server | Server[] | undefined;
119
+ const servers = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof IAmfApi] as IAmfServer | IAmfServer[] | undefined;
120
120
  if (Array.isArray(servers) && servers.length) {
121
121
  result.servers = servers.map(s => this.server(s, objectContext));
122
122
  }
123
- const security = object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof Api] as SecurityRequirement[] | undefined;
123
+ const security = object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof IAmfApi] as IAmfSecurityRequirement[] | undefined;
124
124
  if (Array.isArray(security) && security.length) {
125
125
  result.security = security.map(s => this.securityRequirement(s, objectContext));
126
126
  }
127
127
  return result;
128
128
  }
129
129
 
130
- webApi(object: WebApi, context?: Record<string, string>): ApiWeb {
130
+ webApi(object: IAmfWebApi, context?: Record<string, string>): IApiWeb {
131
131
  return this.api(object, context);
132
132
  }
133
133
 
134
- asyncApi(object: AsyncApi, context?: Record<string, string>): ApiAsync {
134
+ asyncApi(object: IAmfAsyncApi, context?: Record<string, string>): IApiAsync {
135
135
  return this.api(object, context);
136
136
  }
137
137
 
138
- provider(object: Organization, context?: Record<string, string>): ApiOrganization {
138
+ provider(object: IAmfOrganization, context?: Record<string, string>): IApiOrganization {
139
139
  const objectContext = context || object['@context'];
140
- const result: ApiOrganization = {
140
+ const result: IApiOrganization = {
141
141
  id: object['@id'],
142
142
  types: this.readTypes(object['@type'], objectContext),
143
143
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -159,9 +159,9 @@ export class AmfSerializer extends AmfMixin(Object) {
159
159
  return result;
160
160
  }
161
161
 
162
- license(object: License, context?: Record<string, string>): ApiLicense {
162
+ license(object: IAmfLicense, context?: Record<string, string>): IApiLicense {
163
163
  const objectContext = context || object['@context'];
164
- const result: ApiLicense = {
164
+ const result: IApiLicense = {
165
165
  id: object['@id'],
166
166
  types: this.readTypes(object['@type'], objectContext),
167
167
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -183,11 +183,11 @@ export class AmfSerializer extends AmfMixin(Object) {
183
183
  * @param object The AMF Server to serialize.
184
184
  * @returns Serialized Server
185
185
  */
186
- server(object: Server, context?: Record<string, string>): ApiServer {
186
+ server(object: IAmfServer, context?: Record<string, string>): IApiServer {
187
187
  const objectContext = context || object['@context'];
188
188
 
189
189
  const url = this._getValue(object, ns.aml.vocabularies.core.urlTemplate, objectContext) as string || '';
190
- const result: ApiServer = ({
190
+ const result: IApiServer = ({
191
191
  id: object['@id'],
192
192
  types: this.readTypes(object['@type'], objectContext),
193
193
  url,
@@ -199,7 +199,7 @@ export class AmfSerializer extends AmfMixin(Object) {
199
199
  if (description && typeof description === 'string') {
200
200
  result.description = description;
201
201
  }
202
- const variables = (object[this._getAmfKey(ns.aml.vocabularies.apiContract.variable, objectContext) as keyof Server]) as Parameter[];
202
+ const variables = (object[this._getAmfKey(ns.aml.vocabularies.apiContract.variable, objectContext) as keyof IAmfServer]) as IAmfParameter[];
203
203
  if (Array.isArray(variables) && variables.length) {
204
204
  result.variables = variables.map((p) => this.parameter(p, objectContext));
205
205
  }
@@ -211,7 +211,7 @@ export class AmfSerializer extends AmfMixin(Object) {
211
211
  if (protocolVersion) {
212
212
  result.protocolVersion = protocolVersion;
213
213
  }
214
- const security = (object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof Server]) as SecurityRequirement[];
214
+ const security = (object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof IAmfServer]) as IAmfSecurityRequirement[];
215
215
  if (Array.isArray(security) && security.length) {
216
216
  result.security = security.map((p) => this.securityRequirement(p, objectContext));
217
217
  }
@@ -222,9 +222,9 @@ export class AmfSerializer extends AmfMixin(Object) {
222
222
  * @param object The Parameter to serialize.
223
223
  * @returns Serialized Parameter
224
224
  */
225
- parameter(object: Parameter, context?: Record<string, string>): ApiParameter {
225
+ parameter(object: IAmfParameter, context?: Record<string, string>): IApiParameter {
226
226
  const objectContext = context || object['@context'];
227
- const result: ApiParameter = ({
227
+ const result: IApiParameter = ({
228
228
  id: object['@id'],
229
229
  types: this.readTypes(object['@type'], objectContext),
230
230
  payloads: [],
@@ -273,63 +273,63 @@ export class AmfSerializer extends AmfMixin(Object) {
273
273
  if (binding && typeof binding === 'string') {
274
274
  result.binding = binding;
275
275
  }
276
- const schemas = object[this._getAmfKey(ns.aml.vocabularies.shapes.schema, objectContext) as keyof Parameter] as Shape[];
276
+ const schemas = object[this._getAmfKey(ns.aml.vocabularies.shapes.schema, objectContext) as keyof IAmfParameter] as IAmfShape[];
277
277
  if (Array.isArray(schemas) && schemas.length) {
278
278
  const [schema] = schemas;
279
279
  result.schema = this.unknownShape(schema, {
280
280
  trackedId: object['@id'],
281
281
  }, objectContext);
282
282
  }
283
- const payloads = object[this._getAmfKey(ns.aml.vocabularies.apiContract.payload, objectContext) as keyof Parameter] as Payload[];
283
+ const payloads = object[this._getAmfKey(ns.aml.vocabularies.apiContract.payload, objectContext) as keyof IAmfParameter] as IAmfPayload[];
284
284
  if (Array.isArray(payloads) && payloads.length) {
285
285
  result.payloads = payloads.map(p => this.payload(p, objectContext));
286
286
  }
287
- const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof Parameter] as Parameter[];
287
+ const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof IAmfParameter] as IAmfParameter[];
288
288
  if (Array.isArray(examples) && examples.length) {
289
289
  result.examples = examples.map(e => this.example(e, objectContext));
290
290
  }
291
291
  return result;
292
292
  }
293
293
 
294
- unknownShape(object: Shape, options?: ShapeProcessingOptions, context?: Record<string, string>): IShapeUnion {
294
+ unknownShape(object: IAmfShape, options?: IShapeProcessingOptions, context?: Record<string, string>): IShapeUnion {
295
295
  const objectContext = context || object['@context'];
296
296
  const types = this.readTypes(object['@type'], objectContext);
297
297
 
298
298
  if (types.includes(ns.aml.vocabularies.shapes.ScalarShape)) {
299
- return this.scalarShape(object as ScalarShape, options, objectContext);
299
+ return this.scalarShape(object as IAmfScalarShape, options, objectContext);
300
300
  }
301
301
  if (types.includes(ns.w3.shacl.NodeShape)) {
302
- return this.nodeShape(object as NodeShape, options, objectContext);
302
+ return this.nodeShape(object as IAmfNodeShape, options, objectContext);
303
303
  }
304
304
  if (types.includes(ns.aml.vocabularies.shapes.UnionShape)) {
305
- return this.unionShape((object as UnionShape), options, objectContext);
305
+ return this.unionShape((object as IAmfUnionShape), options, objectContext);
306
306
  }
307
307
  if (types.includes(ns.aml.vocabularies.shapes.FileShape)) {
308
- return this.fileShape((object as FileShape), options, objectContext);
308
+ return this.fileShape((object as IAmfFileShape), options, objectContext);
309
309
  }
310
310
  if (types.includes(ns.aml.vocabularies.shapes.SchemaShape)) {
311
- return this.schemaShape((object as SchemaShape), options, objectContext);
311
+ return this.schemaShape((object as IAmfSchemaShape), options, objectContext);
312
312
  }
313
313
  // this must be before the ArrayShape
314
314
  if (types.includes(ns.aml.vocabularies.shapes.TupleShape)) {
315
- return this.tupleShape((object as TupleShape), options, objectContext);
315
+ return this.tupleShape((object as IAmfTupleShape), options, objectContext);
316
316
  }
317
317
  if (types.includes(ns.aml.vocabularies.shapes.ArrayShape) || types.includes(ns.aml.vocabularies.shapes.MatrixShape)) {
318
- return this.arrayShape((object as ArrayShape), options, objectContext);
318
+ return this.arrayShape((object as IAmfArrayShape), options, objectContext);
319
319
  }
320
320
  if (types.includes(ns.aml.vocabularies.shapes.RecursiveShape)) {
321
- return this.recursiveShape((object as RecursiveShape), objectContext);
321
+ return this.recursiveShape((object as IAmfRecursiveShape), objectContext);
322
322
  }
323
323
  // recursiveShape
324
- return this.anyShape((object as AnyShape), options, objectContext);
324
+ return this.anyShape((object as IAmfAnyShape), options, objectContext);
325
325
  }
326
326
 
327
- isLink(object: DomainElement, context?: Record<string, string>): boolean {
327
+ isLink(object: IAmfDomainElement, context?: Record<string, string>): boolean {
328
328
  const objectContext = context || object['@context'];
329
329
  return !!this._getLinkValue(object, ns.aml.vocabularies.document.linkTarget, objectContext);
330
330
  }
331
331
 
332
- getLinkTarget<T extends DomainElement>(object: T, context?: Record<string, string>): T | undefined {
332
+ getLinkTarget<T extends IAmfDomainElement>(object: T, context?: Record<string, string>): T | undefined {
333
333
  const objectContext = context || object['@context'];
334
334
  const id = this._getLinkValue(object, ns.aml.vocabularies.document.linkTarget, objectContext);
335
335
  if (!id) {
@@ -338,7 +338,7 @@ export class AmfSerializer extends AmfMixin(Object) {
338
338
  return this[findAmfType](id, objectContext) as T | undefined;
339
339
  }
340
340
 
341
- shape(object: Shape, context?: Record<string, string>): IShape {
341
+ shape(object: IAmfShape, context?: Record<string, string>): IApiShape {
342
342
  const objectContext = context || object['@context'];
343
343
  this._resolve(object);
344
344
  let linkLabel: string | undefined;
@@ -346,12 +346,12 @@ export class AmfSerializer extends AmfMixin(Object) {
346
346
  if (this.isLink(target)) {
347
347
  linkLabel = (this._getValue(target, ns.aml.vocabularies.document.linkLabel, objectContext)) as string;
348
348
  const id = this._getLinkValue(target, ns.aml.vocabularies.document.linkTarget, objectContext);
349
- const value = this[findAmfType](id, objectContext) as Shape | undefined;
349
+ const value = this[findAmfType](id, objectContext) as IAmfShape | undefined;
350
350
  if (value) {
351
351
  target = value;
352
352
  }
353
353
  }
354
- const result: IShape = ({
354
+ const result: IApiShape = ({
355
355
  id: target['@id'],
356
356
  types: this.readTypes(object['@type'], objectContext),
357
357
  values: [],
@@ -399,31 +399,31 @@ export class AmfSerializer extends AmfMixin(Object) {
399
399
  if (typeof writeOnly === 'boolean') {
400
400
  result.writeOnly = writeOnly;
401
401
  }
402
- const defValue = target[this._getAmfKey(ns.w3.shacl.defaultValue, objectContext) as keyof Shape];
402
+ const defValue = target[this._getAmfKey(ns.w3.shacl.defaultValue, objectContext) as keyof IAmfShape];
403
403
  if (Array.isArray(defValue) && defValue.length) {
404
- result.defaultValue = this.unknownDataNode(defValue[0] as any, objectContext);
404
+ result.defaultValue = this.unknownDataNode(defValue[0] as IAmfDataNode, objectContext);
405
405
  }
406
406
  // @TODO:
407
407
  // if (Array.isArray(inherits) && inherits.length) {
408
408
  // result.inherits = inherits.map((item) => this.unknownShape(item));
409
409
  // }
410
- const orKey = this._getAmfKey(ns.w3.shacl.or, objectContext) as keyof Shape;
411
- const orGroup = (target[orKey]) as Shape[];
410
+ const orKey = this._getAmfKey(ns.w3.shacl.or, objectContext) as keyof IAmfShape;
411
+ const orGroup = (target[orKey]) as IAmfShape[];
412
412
  if (Array.isArray(orGroup) && orGroup.length) {
413
413
  result.or = orGroup.map((item) => this.unknownShape(item, undefined, objectContext));
414
414
  }
415
- const andKey = this._getAmfKey(ns.w3.shacl.and, objectContext) as keyof Shape;
416
- const andGroup = (target[andKey]) as Shape[];
415
+ const andKey = this._getAmfKey(ns.w3.shacl.and, objectContext) as keyof IAmfShape;
416
+ const andGroup = (target[andKey]) as IAmfShape[];
417
417
  if (Array.isArray(andGroup) && andGroup.length) {
418
418
  result.and = andGroup.map((item) => this.unknownShape(item, undefined, objectContext));
419
419
  }
420
- const xoneKey = this._getAmfKey(ns.w3.shacl.xone, objectContext) as keyof Shape;
421
- const xone = (target[xoneKey]) as Shape[];
420
+ const xoneKey = this._getAmfKey(ns.w3.shacl.xone, objectContext) as keyof IAmfShape;
421
+ const xone = (target[xoneKey]) as IAmfShape[];
422
422
  if (Array.isArray(xone) && xone.length) {
423
423
  result.xone = xone.map((item) => this.unknownShape(item, undefined, objectContext));
424
424
  }
425
425
 
426
- const valuesList = target[this._getAmfKey(ns.w3.shacl.in, objectContext) as keyof Shape];
426
+ const valuesList = target[this._getAmfKey(ns.w3.shacl.in, objectContext) as keyof IAmfShape];
427
427
  if (Array.isArray(valuesList) && valuesList.length) {
428
428
  const [values] = valuesList;
429
429
  const prefix = ns.w3.rdfSchema.key;
@@ -441,29 +441,29 @@ export class AmfSerializer extends AmfMixin(Object) {
441
441
  }
442
442
  });
443
443
  }
444
- const notKey = this._getAmfKey(ns.w3.shacl.not, objectContext) as keyof Shape;
445
- let not = target[notKey] as Shape | undefined;
444
+ const notKey = this._getAmfKey(ns.w3.shacl.not, objectContext) as keyof IAmfShape;
445
+ let not = target[notKey] as IAmfShape | undefined;
446
446
  if (not) {
447
447
  if (Array.isArray(not)) {
448
448
  [not] = not;
449
449
  }
450
- result.not = this.unknownShape(not!, undefined, objectContext);
450
+ result.not = this.unknownShape(not as IAmfShape, undefined, objectContext);
451
451
  }
452
452
  return result;
453
453
  }
454
454
 
455
- anyShape(object: AnyShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IAnyShape {
455
+ anyShape(object: IAmfAnyShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiAnyShape {
456
456
  const objectContext = context || object['@context'];
457
457
  let target = object;
458
- const result = (this.shape(target, objectContext)) as IAnyShape;
458
+ const result = (this.shape(target, objectContext)) as IApiAnyShape;
459
459
  if (this.isLink(target)) {
460
- const value = (this.getLinkTarget(target, objectContext)) as Shape | undefined;
460
+ const value = (this.getLinkTarget(target, objectContext)) as IAmfShape | undefined;
461
461
  if (value) {
462
462
  target = value;
463
463
  }
464
464
  }
465
465
  result.examples = [];
466
- const examples = target[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof AnyShape] as Example[];
466
+ const examples = target[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof IAmfAnyShape] as IAmfExample[];
467
467
 
468
468
  if (Array.isArray(examples) && examples.length) {
469
469
  if (options.trackedId) {
@@ -474,14 +474,14 @@ export class AmfSerializer extends AmfMixin(Object) {
474
474
  result.examples = filtered.map((item) => this.example(item, objectContext));
475
475
  }
476
476
  }
477
- const docs = target[this._getAmfKey(ns.aml.vocabularies.core.documentation, objectContext) as keyof AnyShape] as CreativeWork[] | undefined;
477
+ const docs = target[this._getAmfKey(ns.aml.vocabularies.core.documentation, objectContext) as keyof IAmfAnyShape] as IAmfCreativeWork[] | undefined;
478
478
  if (Array.isArray(docs) && docs.length) {
479
479
  const [documentation] = docs;
480
480
  result.documentation = this.documentation(documentation, objectContext);
481
481
  }
482
- const xml = target[this._getAmfKey(ns.aml.vocabularies.shapes.xmlSerialization, objectContext) as keyof AnyShape] as XMLSerializer[] | undefined;
482
+ const xml = target[this._getAmfKey(ns.aml.vocabularies.shapes.xmlSerialization, objectContext) as keyof IAmfAnyShape] as IAmfXMLSerializer[] | undefined;
483
483
  if (Array.isArray(xml) && xml.length) {
484
- result.xmlSerialization = this.xmlSerializer(xml[0] as XMLSerializer, objectContext);
484
+ result.xmlSerialization = this.xmlSerializer(xml[0] as IAmfXMLSerializer, objectContext);
485
485
  }
486
486
  return result;
487
487
  }
@@ -491,24 +491,24 @@ export class AmfSerializer extends AmfMixin(Object) {
491
491
  *
492
492
  * This function is copied from old `api-example-generator/ExampleGenerator`.
493
493
  */
494
- filterTrackedExamples(examples: Example[], trackedId: string, context?: Record<string, string>): Example[] {
494
+ filterTrackedExamples(examples: IAmfExample[], trackedId: string, context?: Record<string, string>): IAmfExample[] {
495
495
  const { docSourceMaps } = ns.aml.vocabularies;
496
- const sourceKey = this._getAmfKey(docSourceMaps.sources, context) as keyof Example;
497
- const trackedKey = this._getAmfKey(docSourceMaps.trackedElement, context) as keyof DocumentSourceMaps;
496
+ const sourceKey = this._getAmfKey(docSourceMaps.sources, context) as keyof IAmfExample;
497
+ const trackedKey = this._getAmfKey(docSourceMaps.trackedElement, context) as keyof IAmfDocumentSourceMaps;
498
498
  const longId = trackedId.indexOf('amf') === -1 ? `amf://id${trackedId}` : trackedId;
499
499
  return examples.filter((item) => {
500
500
  let example = item;
501
501
  if (Array.isArray(example)) {
502
502
  [example] = example;
503
503
  }
504
- let sm = example[sourceKey] as DocumentSourceMaps[] | DocumentSourceMaps | undefined;
504
+ let sm = example[sourceKey] as IAmfDocumentSourceMaps[] | IAmfDocumentSourceMaps | undefined;
505
505
  if (!sm) {
506
506
  return true
507
507
  }
508
508
  if (Array.isArray(sm)) {
509
509
  [sm] = sm;
510
510
  }
511
- let tracked = sm[trackedKey] as SynthesizedField[] | SynthesizedField | undefined;
511
+ let tracked = sm[trackedKey] as IAmfSynthesizedField[] | IAmfSynthesizedField | undefined;
512
512
  if (!tracked) {
513
513
  return true;
514
514
  }
@@ -532,23 +532,23 @@ export class AmfSerializer extends AmfMixin(Object) {
532
532
  * defined for the parent Shape (ed in the type declaration). It filters out all examples
533
533
  * defined in a payload.
534
534
  */
535
- filterNonTrackedExamples(examples: Example[], context?: Record<string, string>): Example[] {
535
+ filterNonTrackedExamples(examples: IAmfExample[], context?: Record<string, string>): IAmfExample[] {
536
536
  const { docSourceMaps } = ns.aml.vocabularies;
537
- const sourceKey = this._getAmfKey(docSourceMaps.sources, context) as keyof Example;
538
- const trackedKey = this._getAmfKey(docSourceMaps.trackedElement, context) as keyof DocumentSourceMaps;
537
+ const sourceKey = this._getAmfKey(docSourceMaps.sources, context) as keyof IAmfExample;
538
+ const trackedKey = this._getAmfKey(docSourceMaps.trackedElement, context) as keyof IAmfDocumentSourceMaps;
539
539
  return examples.filter((item) => {
540
540
  let example = item;
541
541
  if (Array.isArray(example)) {
542
542
  [example] = example;
543
543
  }
544
- let sm = example[sourceKey] as DocumentSourceMaps[] | DocumentSourceMaps | undefined;
544
+ let sm = example[sourceKey] as IAmfDocumentSourceMaps[] | IAmfDocumentSourceMaps | undefined;
545
545
  if (!sm) {
546
546
  return true
547
547
  }
548
548
  if (Array.isArray(sm)) {
549
549
  [sm] = sm;
550
550
  }
551
- let tracked = sm[trackedKey] as SynthesizedField[] | SynthesizedField | undefined;
551
+ let tracked = sm[trackedKey] as IAmfSynthesizedField[] | IAmfSynthesizedField | undefined;
552
552
  if (!tracked) {
553
553
  return true;
554
554
  }
@@ -563,12 +563,12 @@ export class AmfSerializer extends AmfMixin(Object) {
563
563
  });
564
564
  }
565
565
 
566
- scalarShape(object: ScalarShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IScalarShape {
566
+ scalarShape(object: IAmfScalarShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiScalarShape {
567
567
  const objectContext = context || object['@context'];
568
568
  let target = object;
569
- const result = (this.anyShape(target, options, objectContext)) as IScalarShape;
569
+ const result = (this.anyShape(target, options, objectContext)) as IApiScalarShape;
570
570
  if (this.isLink(target)) {
571
- const value = (this.getLinkTarget(target, objectContext)) as ScalarShape | undefined;
571
+ const value = (this.getLinkTarget(target, objectContext)) as IAmfScalarShape | undefined;
572
572
  if (value) {
573
573
  target = value;
574
574
  }
@@ -611,10 +611,10 @@ export class AmfSerializer extends AmfMixin(Object) {
611
611
  return result;
612
612
  }
613
613
 
614
- nodeShape(object: NodeShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): INodeShape {
614
+ nodeShape(object: IAmfNodeShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiNodeShape {
615
615
  const objectContext = context || object['@context'];
616
616
  let target = object;
617
- const result = (this.anyShape(target, options, objectContext)) as INodeShape;
617
+ const result = (this.anyShape(target, options, objectContext)) as IApiNodeShape;
618
618
  if (this.isLink(target)) {
619
619
  const value = this.getLinkTarget(target, objectContext);
620
620
  if (value) {
@@ -655,7 +655,7 @@ export class AmfSerializer extends AmfMixin(Object) {
655
655
  // } else {
656
656
  // result.customShapePropertyDefinitions = [];
657
657
  // }
658
- const properties = (target[this._getAmfKey(ns.w3.shacl.property, objectContext) as keyof NodeShape]) as PropertyShape[];
658
+ const properties = (target[this._getAmfKey(ns.w3.shacl.property, objectContext) as keyof IAmfNodeShape]) as IAmfPropertyShape[];
659
659
  if (Array.isArray(properties) && properties.length) {
660
660
  result.properties = properties.map((item) => this.propertyShape(item, objectContext));
661
661
  } else {
@@ -670,10 +670,10 @@ export class AmfSerializer extends AmfMixin(Object) {
670
670
  }
671
671
 
672
672
 
673
- propertyShape(object: PropertyShape, context?: Record<string, string>): IPropertyShape {
673
+ propertyShape(object: IAmfPropertyShape, context?: Record<string, string>): IApiPropertyShape {
674
674
  const objectContext = context || object['@context'];
675
675
  let target = object;
676
- const result = (this.shape(target, objectContext)) as IPropertyShape;
676
+ const result = (this.shape(target, objectContext)) as IApiPropertyShape;
677
677
  if (this.isLink(target)) {
678
678
  const value = this.getLinkTarget(target, objectContext);
679
679
  if (value) {
@@ -697,7 +697,7 @@ export class AmfSerializer extends AmfMixin(Object) {
697
697
  // result.patternName = patternName.value();
698
698
  // }
699
699
 
700
- const ranges = (target[this._getAmfKey(ns.aml.vocabularies.shapes.range, objectContext) as keyof PropertyShape]) as Shape[];
700
+ const ranges = (target[this._getAmfKey(ns.aml.vocabularies.shapes.range, objectContext) as keyof IAmfPropertyShape]) as IAmfShape[];
701
701
  if (Array.isArray(ranges) && ranges.length) {
702
702
  const [range] = ranges;
703
703
  result.range = this.unknownShape(range, undefined, objectContext);
@@ -705,10 +705,10 @@ export class AmfSerializer extends AmfMixin(Object) {
705
705
  return result;
706
706
  }
707
707
 
708
- unionShape(object: UnionShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IUnionShape {
708
+ unionShape(object: IAmfUnionShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiUnionShape {
709
709
  const objectContext = context || object['@context'];
710
- const anyOf = (object[this._getAmfKey(ns.aml.vocabularies.shapes.anyOf, objectContext) as keyof UnionShape]) as Shape[];
711
- const result = (this.anyShape(object, options, objectContext)) as IUnionShape;
710
+ const anyOf = (object[this._getAmfKey(ns.aml.vocabularies.shapes.anyOf, objectContext) as keyof IAmfUnionShape]) as IAmfShape[];
711
+ const result = (this.anyShape(object, options, objectContext)) as IApiUnionShape;
712
712
  if (Array.isArray(anyOf) && anyOf.length) {
713
713
  const opt = { ...options, trackedId: undefined };
714
714
  result.anyOf = anyOf.map((shape) => this.unknownShape(shape, opt, objectContext));
@@ -718,10 +718,10 @@ export class AmfSerializer extends AmfMixin(Object) {
718
718
  return result;
719
719
  }
720
720
 
721
- fileShape(object: FileShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IFileShape {
721
+ fileShape(object: IAmfFileShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiFileShape {
722
722
  const objectContext = context || object['@context'];
723
723
  let target = object;
724
- const result = (this.anyShape(target, options, objectContext)) as IFileShape;
724
+ const result = (this.anyShape(target, options, objectContext)) as IApiFileShape;
725
725
  if (this.isLink(target)) {
726
726
  const value = (this.getLinkTarget(target, objectContext));
727
727
  if (value) {
@@ -766,10 +766,10 @@ export class AmfSerializer extends AmfMixin(Object) {
766
766
  return result;
767
767
  }
768
768
 
769
- schemaShape(object: SchemaShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): ISchemaShape {
769
+ schemaShape(object: IAmfSchemaShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiSchemaShape {
770
770
  const objectContext = context || object['@context'];
771
771
  let target = object;
772
- const result = (this.anyShape(target, options, objectContext)) as ISchemaShape;
772
+ const result = (this.anyShape(target, options, objectContext)) as IApiSchemaShape;
773
773
  if (this.isLink(target)) {
774
774
  const value = (this.getLinkTarget(target, objectContext));
775
775
  if (value) {
@@ -789,10 +789,10 @@ export class AmfSerializer extends AmfMixin(Object) {
789
789
  }
790
790
 
791
791
 
792
- recursiveShape(object: RecursiveShape, context?: Record<string, string>): IRecursiveShape {
792
+ recursiveShape(object: IAmfRecursiveShape, context?: Record<string, string>): IApiRecursiveShape {
793
793
  const objectContext = context || object['@context'];
794
794
  let target = object;
795
- const result = (this.shape(target, objectContext)) as IRecursiveShape;
795
+ const result = (this.shape(target, objectContext)) as IApiRecursiveShape;
796
796
  if (this.isLink(target)) {
797
797
  const value = (this.getLinkTarget(target, objectContext));
798
798
  if (value) {
@@ -807,10 +807,10 @@ export class AmfSerializer extends AmfMixin(Object) {
807
807
  return result;
808
808
  }
809
809
 
810
- dataArrangeShape(object: DataArrangeShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IDataArrangeShape {
810
+ dataArrangeShape(object: IAmfDataArrangeShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiDataArrangeShape {
811
811
  const objectContext = context || object['@context'];
812
812
  let target = object;
813
- const result = (this.anyShape(target, options, objectContext)) as IDataArrangeShape;
813
+ const result = (this.anyShape(target, options, objectContext)) as IApiDataArrangeShape;
814
814
  if (this.isLink(target)) {
815
815
  const value = (this.getLinkTarget(target, objectContext));
816
816
  if (value) {
@@ -831,10 +831,10 @@ export class AmfSerializer extends AmfMixin(Object) {
831
831
  return result;
832
832
  }
833
833
 
834
- arrayShape(object: ArrayShape, options: ShapeProcessingOptions={}, context?: Record<string, string>): IArrayShape {
834
+ arrayShape(object: IAmfArrayShape, options: IShapeProcessingOptions={}, context?: Record<string, string>): IApiArrayShape {
835
835
  const objectContext = context || object['@context'];
836
836
  let target = object;
837
- const result = (this.dataArrangeShape(target, options, objectContext)) as IArrayShape;
837
+ const result = (this.dataArrangeShape(target, options, objectContext)) as IApiArrayShape;
838
838
  if (this.isLink(target)) {
839
839
  const value = (this.getLinkTarget(target, objectContext));
840
840
  if (value) {
@@ -842,7 +842,7 @@ export class AmfSerializer extends AmfMixin(Object) {
842
842
  }
843
843
  }
844
844
 
845
- const items = target[this._getAmfKey(ns.aml.vocabularies.shapes.items, objectContext) as keyof ArrayShape] as Shape[] | undefined;
845
+ const items = target[this._getAmfKey(ns.aml.vocabularies.shapes.items, objectContext) as keyof IAmfArrayShape] as IAmfShape[] | undefined;
846
846
  if (Array.isArray(items) && items.length) {
847
847
  const [item] = items;
848
848
  result.items = this.unknownShape(item, undefined, objectContext);
@@ -850,17 +850,17 @@ export class AmfSerializer extends AmfMixin(Object) {
850
850
  return result;
851
851
  }
852
852
 
853
- tupleShape(object: TupleShape, options?: ShapeProcessingOptions, context?: Record<string, string>): ITupleShape {
853
+ tupleShape(object: IAmfTupleShape, options?: IShapeProcessingOptions, context?: Record<string, string>): IApiTupleShape {
854
854
  const objectContext = context || object['@context'];
855
855
  let target = object;
856
- const result = (this.dataArrangeShape(target, options, objectContext)) as ITupleShape;
856
+ const result = (this.dataArrangeShape(target, options, objectContext)) as IApiTupleShape;
857
857
  if (this.isLink(target)) {
858
858
  const value = (this.getLinkTarget(target, objectContext));
859
859
  if (value) {
860
860
  target = value;
861
861
  }
862
862
  }
863
- const items = target[this._getAmfKey(ns.aml.vocabularies.shapes.items, objectContext) as keyof TupleShape] as any[] | undefined;
863
+ const items = target[this._getAmfKey(ns.aml.vocabularies.shapes.items, objectContext) as keyof IAmfTupleShape] as any[] | undefined;
864
864
  const prefix = this._getAmfKey(ns.w3.rdfSchema.key, objectContext) as string;
865
865
  if (Array.isArray(items) && items.length) {
866
866
  result.items = [];
@@ -887,9 +887,9 @@ export class AmfSerializer extends AmfMixin(Object) {
887
887
  * @param object The CreativeWork to serialize.
888
888
  * @returns Serialized CreativeWork
889
889
  */
890
- documentation(object: CreativeWork, context?: Record<string, string>): ApiDocumentation {
890
+ documentation(object: IAmfCreativeWork, context?: Record<string, string>): IApiDocumentation {
891
891
  const objectContext = context || object['@context'];
892
- const result: ApiDocumentation = ({
892
+ const result: IApiDocumentation = ({
893
893
  id: object['@id'],
894
894
  types: this.readTypes(object['@type'], objectContext),
895
895
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -914,10 +914,10 @@ export class AmfSerializer extends AmfMixin(Object) {
914
914
  * @param object The Example to serialize.
915
915
  * @returns Serialized Example
916
916
  */
917
- example(object: Example, context?: Record<string, string>): IDataExample {
917
+ example(object: IAmfExample, context?: Record<string, string>): IApiDataExample {
918
918
  const objectContext = context || object['@context'];
919
919
  this._resolve(object);
920
- const result: IDataExample = ({
920
+ const result: IApiDataExample = ({
921
921
  id: object['@id'],
922
922
  types: this.readTypes(object['@type'], objectContext),
923
923
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -952,7 +952,7 @@ export class AmfSerializer extends AmfMixin(Object) {
952
952
  // if (!mediaType.isNullOrEmpty) {
953
953
  // result.mediaType = mediaType.value();
954
954
  // }
955
- const structuredValue = object[this._getAmfKey(ns.aml.vocabularies.document.structuredValue, objectContext) as keyof Example] as DataNode[] | undefined;
955
+ const structuredValue = object[this._getAmfKey(ns.aml.vocabularies.document.structuredValue, objectContext) as keyof IAmfExample] as IAmfDataNode[] | undefined;
956
956
  if (Array.isArray(structuredValue) && structuredValue.length) {
957
957
  const [value] = structuredValue;
958
958
  result.structuredValue = this.unknownDataNode(value, objectContext);
@@ -960,9 +960,9 @@ export class AmfSerializer extends AmfMixin(Object) {
960
960
  return result;
961
961
  }
962
962
 
963
- xmlSerializer(object: XMLSerializer, context?: Record<string, string>): IXmlSerializer {
963
+ xmlSerializer(object: IAmfXMLSerializer, context?: Record<string, string>): IApiXmlSerializer {
964
964
  const objectContext = context || object['@context'];
965
- const result: IXmlSerializer = ({
965
+ const result: IApiXmlSerializer = ({
966
966
  id: object['@id'],
967
967
  types: this.readTypes(object['@type'], objectContext),
968
968
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -992,23 +992,23 @@ export class AmfSerializer extends AmfMixin(Object) {
992
992
  return result;
993
993
  }
994
994
 
995
- unknownDataNode(object: DataNode, context?: Record<string, string>): IDataNodeUnion | undefined {
995
+ unknownDataNode(object: IAmfDataNode, context?: Record<string, string>): IApiDataNodeUnion | undefined {
996
996
  const types = this.readTypes(object['@type'], context);
997
997
 
998
998
  if (types.includes(ns.aml.vocabularies.data.Scalar)) {
999
- return this.scalarNode((object as ScalarNode), context);
999
+ return this.scalarNode((object as IAmfScalarNode), context);
1000
1000
  }
1001
1001
  if (types.includes(ns.aml.vocabularies.data.Object)) {
1002
- return this.objectNode((object as ObjectNode), context);
1002
+ return this.objectNode((object as IAmfObjectNode), context);
1003
1003
  }
1004
1004
  if (types.includes(ns.aml.vocabularies.data.Array)) {
1005
- return this.arrayNode((object as ArrayNode), context);
1005
+ return this.arrayNode((object as IAmfArrayNode), context);
1006
1006
  }
1007
1007
  return undefined;
1008
1008
  }
1009
1009
 
1010
- dataNode(object: DataNode, context?: Record<string, string>): IDataNode {
1011
- const result: IDataNode = {
1010
+ dataNode(object: IAmfDataNode, context?: Record<string, string>): IApiDataNode {
1011
+ const result: IApiDataNode = {
1012
1012
  id: object['@id'],
1013
1013
  types: this.readTypes(object['@type'], context),
1014
1014
  customDomainProperties: this.customDomainProperties(object, context),
@@ -1021,9 +1021,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1021
1021
  return result;
1022
1022
  }
1023
1023
 
1024
- scalarNode(object: ScalarNode, context?: Record<string, string>): IScalarNode {
1024
+ scalarNode(object: IAmfScalarNode, context?: Record<string, string>): IApiScalarNode {
1025
1025
  const objectContext = context || object['@context'];
1026
- const result = (this.dataNode(object, context)) as IScalarNode;
1026
+ const result = (this.dataNode(object, context)) as IApiScalarNode;
1027
1027
 
1028
1028
  const value = this._getValue(object, ns.aml.vocabularies.data.value, objectContext);
1029
1029
  if (value && typeof value === 'string') {
@@ -1036,20 +1036,20 @@ export class AmfSerializer extends AmfMixin(Object) {
1036
1036
  return result;
1037
1037
  }
1038
1038
 
1039
- objectNode(object: ObjectNode, context?: Record<string, string>): IObjectNode {
1039
+ objectNode(object: IAmfObjectNode, context?: Record<string, string>): IApiObjectNode {
1040
1040
  const objectContext = context || object['@context'];
1041
- const result = (this.dataNode(object, context)) as IObjectNode;
1041
+ const result = (this.dataNode(object, context)) as IApiObjectNode;
1042
1042
  result.properties = {};
1043
1043
  const prefix = ns.aml.vocabularies.data.key;
1044
1044
  const prefixCompact = `${this._getAmfKey(prefix, objectContext)}:`;
1045
1045
  Object.keys(object).forEach((key) => {
1046
1046
  if (key.startsWith(prefix) || key.startsWith(prefixCompact)) {
1047
- let value = object[key as keyof ObjectNode] as any | undefined;
1047
+ let value = object[key as keyof IAmfObjectNode] as IAmfDataNode | undefined;
1048
1048
  if (Array.isArray(value)) {
1049
1049
  [value] = value;
1050
1050
  }
1051
1051
  const name = key.replace(prefix, '').replace(prefixCompact, '');
1052
- const nodeValue = this.unknownDataNode(value, context);
1052
+ const nodeValue = this.unknownDataNode(value as IAmfDataNode, context);
1053
1053
  if (nodeValue) {
1054
1054
  result.properties[name] = nodeValue;
1055
1055
  }
@@ -1058,13 +1058,18 @@ export class AmfSerializer extends AmfMixin(Object) {
1058
1058
  return result;
1059
1059
  }
1060
1060
 
1061
- arrayNode(object: ArrayNode, context?: Record<string, string>): IArrayNode {
1061
+ arrayNode(object: IAmfArrayNode, context?: Record<string, string>): IApiArrayNode {
1062
1062
  const objectContext = context || object['@context'];
1063
- const result = (this.dataNode(object, objectContext)) as IArrayNode;
1063
+ const result = (this.dataNode(object, objectContext)) as IApiArrayNode;
1064
1064
  result.members = [];
1065
- const members = (this._computePropertyArray(object, ns.w3.rdfSchema.member)) as DataNode[];
1065
+ const members = (this._computePropertyArray(object, ns.w3.rdfSchema.member)) as IAmfDataNode[];
1066
1066
  if (Array.isArray(members) && members.length) {
1067
- result.members = members.map((item) => this.unknownDataNode(item)!);
1067
+ members.forEach(n => {
1068
+ const item = this.unknownDataNode(n);
1069
+ if (item) {
1070
+ result.members.push(item);
1071
+ }
1072
+ });
1068
1073
  }
1069
1074
  return result;
1070
1075
  }
@@ -1073,14 +1078,14 @@ export class AmfSerializer extends AmfMixin(Object) {
1073
1078
  * Adds the custom domain properties to the currently processed property, a.k.a annotations.
1074
1079
  * @returns The list of custom domain properties.
1075
1080
  */
1076
- customDomainProperties(object: DomainElement, context?: Record<string, string>): ICustomDomainProperty[] {
1077
- const result: ICustomDomainProperty[] = [];
1081
+ customDomainProperties(object: IAmfDomainElement, context?: Record<string, string>): IApiCustomDomainProperty[] {
1082
+ const result: IApiCustomDomainProperty[] = [];
1078
1083
  const objectContext = context || object['@context'];
1079
1084
  const ids = this._getLinkValues(object, ns.aml.vocabularies.document.customDomainProperties, objectContext);
1080
1085
  if (Array.isArray(ids) && ids.length) {
1081
1086
  ids.forEach((id) => {
1082
1087
  const key = `amf://id${id}`;
1083
- let value = (object[id as keyof DomainElement] || object[key as keyof DomainElement]) as DomainElement[] | DomainElement | undefined;
1088
+ let value = (object[id as keyof IAmfDomainElement] || object[key as keyof IAmfDomainElement]) as IAmfDomainElement[] | IAmfDomainElement | undefined;
1084
1089
  if (!value) {
1085
1090
  return;
1086
1091
  }
@@ -1092,7 +1097,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1092
1097
  if (!name || !extension) {
1093
1098
  return;
1094
1099
  }
1095
- const cdp: ICustomDomainProperty = ({
1100
+ const cdp: IApiCustomDomainProperty = ({
1096
1101
  id: key,
1097
1102
  name,
1098
1103
  extension,
@@ -1103,9 +1108,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1103
1108
  return result;
1104
1109
  }
1105
1110
 
1106
- endPoint(object: EndPoint, context?: Record<string, string>): ApiEndPoint {
1111
+ endPoint(object: IAmfEndPoint, context?: Record<string, string>): IApiEndPoint {
1107
1112
  const objectContext = context || object['@context'];
1108
- const result: ApiEndPoint = ({
1113
+ const result: IApiEndPoint = ({
1109
1114
  id: object['@id'],
1110
1115
  types: this.readTypes(object['@type'], objectContext),
1111
1116
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1137,7 +1142,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1137
1142
  }
1138
1143
  const operations = this[getArrayItems](object, ns.aml.vocabularies.apiContract.supportedOperation, objectContext);
1139
1144
  if (Array.isArray(operations) && operations.length) {
1140
- result.operations = operations.map(i => this.operation((i as Operation), objectContext));
1145
+ result.operations = operations.map(i => this.operation((i as IAmfOperation), objectContext));
1141
1146
  }
1142
1147
  const parameters = this[getArrayItems](object, ns.aml.vocabularies.apiContract.parameter, objectContext);
1143
1148
  if (Array.isArray(parameters) && parameters.length) {
@@ -1145,7 +1150,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1145
1150
  }
1146
1151
  const payloads = this[getArrayItems](object, ns.aml.vocabularies.apiContract.payload, objectContext);
1147
1152
  if (Array.isArray(payloads) && payloads.length) {
1148
- result.payloads = payloads.map(i => this.payload(/** @type Payload */(i as Payload), objectContext));
1153
+ result.payloads = payloads.map(i => this.payload(/** @type IAmfPayload */(i as IAmfPayload), objectContext));
1149
1154
  }
1150
1155
  const servers = this[getArrayItems](object, ns.aml.vocabularies.apiContract.server, objectContext);
1151
1156
  if (Array.isArray(servers) && servers.length) {
@@ -1173,9 +1178,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1173
1178
  return result;
1174
1179
  }
1175
1180
 
1176
- operation(object: Operation, context?: Record<string, string>): ApiOperation {
1181
+ operation(object: IAmfOperation, context?: Record<string, string>): IApiOperation {
1177
1182
  const objectContext = context || object['@context'];
1178
- const result: ApiOperation = ({
1183
+ const result: IApiOperation = ({
1179
1184
  id: object['@id'],
1180
1185
  types: this.readTypes(object['@type'], objectContext),
1181
1186
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1230,50 +1235,50 @@ export class AmfSerializer extends AmfMixin(Object) {
1230
1235
  result.contentType = contentType;
1231
1236
  }
1232
1237
 
1233
- let expects = object[this._getAmfKey(ns.aml.vocabularies.apiContract.expects, objectContext) as keyof Operation] as Request[] | Request | undefined;
1238
+ let expects = object[this._getAmfKey(ns.aml.vocabularies.apiContract.expects, objectContext) as keyof IAmfOperation] as IAmfRequest[] | IAmfRequest | undefined;
1234
1239
  if (expects) {
1235
1240
  if (Array.isArray(expects)) {
1236
1241
  [expects] = expects;
1237
1242
  }
1238
1243
  result.request = this.request(expects, objectContext);
1239
1244
  }
1240
- let documentation = object[this._getAmfKey(ns.aml.vocabularies.core.documentation, objectContext) as keyof Operation] as CreativeWork[] | CreativeWork | undefined;
1245
+ let documentation = object[this._getAmfKey(ns.aml.vocabularies.core.documentation, objectContext) as keyof IAmfOperation] as IAmfCreativeWork[] | IAmfCreativeWork | undefined;
1241
1246
  if (documentation) {
1242
1247
  if (Array.isArray(documentation)) {
1243
1248
  [documentation] = documentation;
1244
1249
  }
1245
1250
  result.documentation = this.documentation(documentation, objectContext);
1246
1251
  }
1247
- const responses = object[this._getAmfKey(ns.aml.vocabularies.apiContract.returns, objectContext) as keyof Operation] as Response[] | undefined;
1252
+ const responses = object[this._getAmfKey(ns.aml.vocabularies.apiContract.returns, objectContext) as keyof IAmfOperation] as IAmfResponse[] | undefined;
1248
1253
  if (Array.isArray(responses)) {
1249
1254
  result.responses = responses.map(r => this.response(r, objectContext));
1250
1255
  }
1251
- const callbacks = object[this._getAmfKey(ns.aml.vocabularies.apiContract.callback, objectContext) as keyof Operation] as Callback[] | undefined;
1256
+ const callbacks = object[this._getAmfKey(ns.aml.vocabularies.apiContract.callback, objectContext) as keyof IAmfOperation] as IAmfCallback[] | undefined;
1252
1257
  if (Array.isArray(callbacks)) {
1253
1258
  result.callbacks = callbacks.map(c => this.callback(c, objectContext));
1254
1259
  }
1255
- const servers = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof Operation] as Server[] | undefined;
1260
+ const servers = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof IAmfOperation] as IAmfServer[] | undefined;
1256
1261
  if (Array.isArray(servers)) {
1257
1262
  result.servers = servers.map(s => this.server(s));
1258
1263
  }
1259
- const security = object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof Operation] as SecurityRequirement[] | undefined;
1264
+ const security = object[this._getAmfKey(ns.aml.vocabularies.security.security, objectContext) as keyof IAmfOperation] as IAmfSecurityRequirement[] | undefined;
1260
1265
  if (Array.isArray(security)) {
1261
1266
  result.security = security.map(s => this.securityRequirement(s, objectContext));
1262
1267
  }
1263
- const tags = object[this._getAmfKey(ns.aml.vocabularies.apiContract.tag, objectContext) as keyof Operation] as Tag[] | undefined;
1268
+ const tags = object[this._getAmfKey(ns.aml.vocabularies.apiContract.tag, objectContext) as keyof IAmfOperation] as IAmfTag[] | undefined;
1264
1269
  if (Array.isArray(tags) && tags.length) {
1265
1270
  result.tags = tags.map(s => this.tag(s, objectContext));
1266
1271
  }
1267
- const traits = object[this._getAmfKey(ns.aml.vocabularies.document.extends, objectContext) as keyof Operation] as ParametrizedTrait[] | undefined;
1272
+ const traits = object[this._getAmfKey(ns.aml.vocabularies.document.extends, objectContext) as keyof IAmfOperation] as IAmfParametrizedTrait[] | undefined;
1268
1273
  if (Array.isArray(traits) && traits.length) {
1269
1274
  result.extends = traits.map(t => this.parametrizedTrait(t, objectContext));
1270
1275
  }
1271
1276
  return result;
1272
1277
  }
1273
1278
 
1274
- tag(object: Tag, context?: Record<string, string>): ApiTag {
1279
+ tag(object: IAmfTag, context?: Record<string, string>): IApiTag {
1275
1280
  const objectContext = context || object['@context'];
1276
- const result: ApiTag = ({
1281
+ const result: IApiTag = ({
1277
1282
  id: object['@id'],
1278
1283
  types: this.readTypes(object['@type'], objectContext),
1279
1284
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1287,9 +1292,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1287
1292
  return result;
1288
1293
  }
1289
1294
 
1290
- callback(object: Callback, context?: Record<string, string>): ApiCallback {
1295
+ callback(object: IAmfCallback, context?: Record<string, string>): IApiCallback {
1291
1296
  const objectContext = context || object['@context'];
1292
- const result: ApiCallback = ({
1297
+ const result: IApiCallback = ({
1293
1298
  id: object['@id'],
1294
1299
  types: this.readTypes(object['@type'], objectContext),
1295
1300
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1304,7 +1309,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1304
1309
  if (expression && typeof expression === 'string') {
1305
1310
  result.expression = expression;
1306
1311
  }
1307
- let endpoint = object[this._getAmfKey(ns.aml.vocabularies.apiContract.endpoint, objectContext) as keyof Callback] as EndPoint[] | EndPoint | undefined;
1312
+ let endpoint = object[this._getAmfKey(ns.aml.vocabularies.apiContract.endpoint, objectContext) as keyof IAmfCallback] as IAmfEndPoint[] | IAmfEndPoint | undefined;
1308
1313
  if (endpoint) {
1309
1314
  if (Array.isArray(endpoint)) {
1310
1315
  [endpoint] = endpoint;
@@ -1315,9 +1320,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1315
1320
  }
1316
1321
 
1317
1322
 
1318
- request(object: Request, context?: Record<string, string>): ApiRequest {
1323
+ request(object: IAmfRequest, context?: Record<string, string>): IApiRequest {
1319
1324
  const objectContext = context || object['@context'];
1320
- const result: ApiRequest = ({
1325
+ const result: IApiRequest = ({
1321
1326
  id: object['@id'],
1322
1327
  types: this.readTypes(object['@type'], objectContext),
1323
1328
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1338,7 +1343,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1338
1343
  if (required && typeof required === 'boolean') {
1339
1344
  result.required = required;
1340
1345
  }
1341
- let queryString = object[this._getAmfKey(ns.aml.vocabularies.apiContract.queryString, objectContext) as keyof Request] as Shape[] | Shape | undefined;
1346
+ let queryString = object[this._getAmfKey(ns.aml.vocabularies.apiContract.queryString, objectContext) as keyof IAmfRequest] as IAmfShape[] | IAmfShape | undefined;
1342
1347
  if (queryString) {
1343
1348
  if (Array.isArray(queryString)) {
1344
1349
  [queryString] = queryString;
@@ -1361,16 +1366,16 @@ export class AmfSerializer extends AmfMixin(Object) {
1361
1366
  if (Array.isArray(cookieParameters) && cookieParameters.length) {
1362
1367
  result.cookieParameters = cookieParameters.map(p => this.parameter(p, objectContext));
1363
1368
  }
1364
- const payloads = this[getArrayItems](object, ns.aml.vocabularies.apiContract.payload, objectContext) as Payload[] | undefined;
1369
+ const payloads = this[getArrayItems](object, ns.aml.vocabularies.apiContract.payload, objectContext) as IAmfPayload[] | undefined;
1365
1370
  if (Array.isArray(payloads) && payloads.length) {
1366
1371
  result.payloads = payloads.map(p => this.payload(p, objectContext));
1367
1372
  }
1368
1373
  return result;
1369
1374
  }
1370
1375
 
1371
- response(object: Response, context?: Record<string, string>): ApiResponse {
1376
+ response(object: IAmfResponse, context?: Record<string, string>): IApiResponse {
1372
1377
  const objectContext = context || object['@context'];
1373
- const result: ApiResponse = ({
1378
+ const result: IApiResponse = ({
1374
1379
  id: object['@id'],
1375
1380
  types: this.readTypes(object['@type'], objectContext),
1376
1381
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1397,24 +1402,24 @@ export class AmfSerializer extends AmfMixin(Object) {
1397
1402
  if (Array.isArray(headers) && headers.length) {
1398
1403
  result.headers = headers.map(p => this.parameter(p, objectContext));
1399
1404
  }
1400
- const payloads = this[getArrayItems](object, ns.aml.vocabularies.apiContract.payload, objectContext) as Payload[] | undefined;
1405
+ const payloads = this[getArrayItems](object, ns.aml.vocabularies.apiContract.payload, objectContext) as IAmfPayload[] | undefined;
1401
1406
  if (Array.isArray(payloads) && payloads.length) {
1402
1407
  result.payloads = payloads.map(p => this.payload(p, objectContext));
1403
1408
  }
1404
- const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof Response] as Example[] | undefined;
1409
+ const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof IAmfResponse] as IAmfExample[] | undefined;
1405
1410
  if (Array.isArray(examples) && examples.length) {
1406
1411
  result.examples = examples.map(e => this.example(e, objectContext));
1407
1412
  }
1408
- const links = object[this._getAmfKey(ns.aml.vocabularies.apiContract.link, objectContext) as keyof Response] as TemplatedLink[] | undefined;
1413
+ const links = object[this._getAmfKey(ns.aml.vocabularies.apiContract.link, objectContext) as keyof IAmfResponse] as IAmfTemplatedLink[] | undefined;
1409
1414
  if (Array.isArray(links) && links.length) {
1410
1415
  result.links = links.map(p => this.templatedLink(p, objectContext));
1411
1416
  }
1412
1417
  return result;
1413
1418
  }
1414
1419
 
1415
- payload(object: Payload, context?: Record<string, string>): ApiPayload {
1420
+ payload(object: IAmfPayload, context?: Record<string, string>): IApiPayload {
1416
1421
  const objectContext = context || object['@context'];
1417
- const result: ApiPayload = ({
1422
+ const result: IApiPayload = ({
1418
1423
  id: object['@id'],
1419
1424
  types: this.readTypes(object['@type'], objectContext),
1420
1425
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1431,7 +1436,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1431
1436
  if (mediaType && typeof mediaType === 'string') {
1432
1437
  result.mediaType = mediaType;
1433
1438
  }
1434
- let schema = object[this._getAmfKey(ns.aml.vocabularies.shapes.schema, objectContext) as keyof Payload] as Shape | Shape[] | undefined;
1439
+ let schema = object[this._getAmfKey(ns.aml.vocabularies.shapes.schema, objectContext) as keyof IAmfPayload] as IAmfShape | IAmfShape[] | undefined;
1435
1440
  if (schema) {
1436
1441
  if (Array.isArray(schema)) {
1437
1442
  [schema] = schema;
@@ -1440,7 +1445,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1440
1445
  trackedId: result.id,
1441
1446
  }, objectContext);
1442
1447
  }
1443
- const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof Payload] as Example[] | undefined;
1448
+ const examples = object[this._getAmfKey(ns.aml.vocabularies.apiContract.examples, objectContext) as keyof IAmfPayload] as IAmfExample[] | undefined;
1444
1449
  if (Array.isArray(examples) && examples.length) {
1445
1450
  result.examples = examples.map(e => this.example(e, objectContext));
1446
1451
  }
@@ -1450,9 +1455,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1450
1455
  return result;
1451
1456
  }
1452
1457
 
1453
- templatedLink(object: TemplatedLink, context?: Record<string, string>): ApiTemplatedLink {
1458
+ templatedLink(object: IAmfTemplatedLink, context?: Record<string, string>): IApiTemplatedLink {
1454
1459
  const objectContext = context || object['@context'];
1455
- const result: ApiTemplatedLink = ({
1460
+ const result: IApiTemplatedLink = ({
1456
1461
  id: object['@id'],
1457
1462
  types: this.readTypes(object['@type'], objectContext),
1458
1463
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1472,14 +1477,14 @@ export class AmfSerializer extends AmfMixin(Object) {
1472
1477
  if (operationId && typeof operationId === 'string') {
1473
1478
  result.operationId = operationId;
1474
1479
  }
1475
- let server = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof TemplatedLink] as Server[] | Server | undefined;
1480
+ let server = object[this._getAmfKey(ns.aml.vocabularies.apiContract.server, objectContext) as keyof IAmfTemplatedLink] as IAmfServer[] | IAmfServer | undefined;
1476
1481
  if (server) {
1477
1482
  if (Array.isArray(server)) {
1478
1483
  [server] = server;
1479
1484
  }
1480
1485
  result.server = this.server(server, objectContext);
1481
1486
  }
1482
- let mapping = (object[this._getAmfKey(ns.aml.vocabularies.apiContract.mapping, objectContext) as keyof TemplatedLink]) as IriTemplateMapping[] | undefined;
1487
+ let mapping = (object[this._getAmfKey(ns.aml.vocabularies.apiContract.mapping, objectContext) as keyof IAmfTemplatedLink]) as IAmfIriTemplateMapping[] | undefined;
1483
1488
  if (mapping) {
1484
1489
  if (mapping && !Array.isArray(mapping)) {
1485
1490
  mapping = [mapping];
@@ -1497,9 +1502,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1497
1502
  return result;
1498
1503
  }
1499
1504
 
1500
- iriTemplateMapping(object: IriTemplateMapping, context?: Record<string, string>): ApiIriTemplateMapping {
1505
+ iriTemplateMapping(object: IAmfIriTemplateMapping, context?: Record<string, string>): IApiIriTemplateMapping {
1501
1506
  const objectContext = context || object['@context'];
1502
- const result: ApiIriTemplateMapping = ({
1507
+ const result: IApiIriTemplateMapping = ({
1503
1508
  id: object['@id'],
1504
1509
  types: this.readTypes(object['@type'], objectContext),
1505
1510
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1518,9 +1523,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1518
1523
  }
1519
1524
 
1520
1525
 
1521
- parametrizedSecurityScheme(object: ParametrizedSecurityScheme, context?: Record<string, string>): ApiParametrizedSecurityScheme {
1526
+ parametrizedSecurityScheme(object: IAmfParametrizedSecurityScheme, context?: Record<string, string>): IApiParametrizedSecurityScheme {
1522
1527
  const objectContext = context || object['@context'];
1523
- const result: ApiParametrizedSecurityScheme = ({
1528
+ const result: IApiParametrizedSecurityScheme = ({
1524
1529
  id: object['@id'],
1525
1530
  types: this.readTypes(object['@type'], objectContext),
1526
1531
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1531,14 +1536,14 @@ export class AmfSerializer extends AmfMixin(Object) {
1531
1536
  if (name && typeof name === 'string') {
1532
1537
  result.name = name;
1533
1538
  }
1534
- let scheme = object[this._getAmfKey(ns.aml.vocabularies.security.scheme, objectContext) as keyof ParametrizedSecurityScheme] as SecurityScheme | SecurityScheme[] | undefined;
1539
+ let scheme = object[this._getAmfKey(ns.aml.vocabularies.security.scheme, objectContext) as keyof IAmfParametrizedSecurityScheme] as IAmfSecurityScheme | IAmfSecurityScheme[] | undefined;
1535
1540
  if (scheme) {
1536
1541
  if (Array.isArray(scheme)) {
1537
1542
  [scheme] = scheme;
1538
1543
  }
1539
1544
  result.scheme = this.securityScheme(scheme, objectContext);
1540
1545
  }
1541
- let settings = object[this._getAmfKey(ns.aml.vocabularies.security.settings, objectContext) as keyof ParametrizedSecurityScheme] as Settings | Settings[] | undefined;
1546
+ let settings = object[this._getAmfKey(ns.aml.vocabularies.security.settings, objectContext) as keyof IAmfParametrizedSecurityScheme] as IAmfSettings | IAmfSettings[] | undefined;
1542
1547
  if (settings) {
1543
1548
  if (Array.isArray(settings)) {
1544
1549
  [settings] = settings;
@@ -1549,10 +1554,10 @@ export class AmfSerializer extends AmfMixin(Object) {
1549
1554
  }
1550
1555
 
1551
1556
 
1552
- securitySchemeListItem(object: SecurityScheme, context?: Record<string, string>): ApiSecuritySchemeListItem {
1557
+ securitySchemeListItem(object: IAmfSecurityScheme, context?: Record<string, string>): IApiSecuritySchemeListItem {
1553
1558
  const objectContext = context || object['@context'];
1554
1559
 
1555
- const result: ApiSecuritySchemeListItem = ({
1560
+ const result: IApiSecuritySchemeListItem = ({
1556
1561
  id: object['@id'],
1557
1562
  types: this.readTypes(object['@type'], objectContext),
1558
1563
  type: '',
@@ -1573,9 +1578,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1573
1578
  return result;
1574
1579
  }
1575
1580
 
1576
- securityScheme(object: SecurityScheme, context?: Record<string, string>): ApiSecurityScheme {
1581
+ securityScheme(object: IAmfSecurityScheme, context?: Record<string, string>): IApiSecurityScheme {
1577
1582
  const objectContext = context || object['@context'];
1578
- const result: ApiSecurityScheme = ({
1583
+ const result: IApiSecurityScheme = ({
1579
1584
  id: object['@id'],
1580
1585
  types: this.readTypes(object['@type'], objectContext),
1581
1586
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1601,14 +1606,14 @@ export class AmfSerializer extends AmfMixin(Object) {
1601
1606
  if (type && typeof type === 'string') {
1602
1607
  result.type = type;
1603
1608
  }
1604
- let settings = object[this._getAmfKey(ns.aml.vocabularies.security.settings, objectContext) as keyof SecurityScheme] as Settings[] | Settings | undefined;
1609
+ let settings = object[this._getAmfKey(ns.aml.vocabularies.security.settings, objectContext) as keyof IAmfSecurityScheme] as IAmfSettings[] | IAmfSettings | undefined;
1605
1610
  if (settings) {
1606
1611
  if (Array.isArray(settings)) {
1607
1612
  [settings] = settings;
1608
1613
  }
1609
1614
  result.settings = this.securitySettings(settings, objectContext);
1610
1615
  }
1611
- let queryString = object[this._getAmfKey(ns.aml.vocabularies.apiContract.queryString, objectContext) as keyof SecurityScheme] as Shape[] | Shape | undefined;
1616
+ let queryString = object[this._getAmfKey(ns.aml.vocabularies.apiContract.queryString, objectContext) as keyof IAmfSecurityScheme] as IAmfShape[] | IAmfShape | undefined;
1612
1617
  if (queryString) {
1613
1618
  if (Array.isArray(queryString)) {
1614
1619
  [queryString] = queryString;
@@ -1623,16 +1628,16 @@ export class AmfSerializer extends AmfMixin(Object) {
1623
1628
  if (Array.isArray(queryParameters) && queryParameters.length) {
1624
1629
  result.queryParameters = queryParameters.map(p => this.parameter(p, objectContext));
1625
1630
  }
1626
- const responses = this[getArrayItems](object, ns.aml.vocabularies.apiContract.response, objectContext) as Response[] | undefined;
1631
+ const responses = this[getArrayItems](object, ns.aml.vocabularies.apiContract.response, objectContext) as IAmfResponse[] | undefined;
1627
1632
  if (Array.isArray(responses) && responses.length) {
1628
1633
  result.responses = responses.map(p => this.response(p, objectContext));
1629
1634
  }
1630
1635
  return result;
1631
1636
  }
1632
1637
 
1633
- securityRequirement(object: SecurityRequirement, context?: Record<string, string>): ApiSecurityRequirement {
1638
+ securityRequirement(object: IAmfSecurityRequirement, context?: Record<string, string>): IApiSecurityRequirement {
1634
1639
  const objectContext = context || object['@context'];
1635
- const result: ApiSecurityRequirement = ({
1640
+ const result: IApiSecurityRequirement = ({
1636
1641
  id: object['@id'],
1637
1642
  types: this.readTypes(object['@type'], objectContext),
1638
1643
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1644,42 +1649,42 @@ export class AmfSerializer extends AmfMixin(Object) {
1644
1649
  if (name && typeof name === 'string') {
1645
1650
  result.name = name;
1646
1651
  }
1647
- const schemes = (object[this._getAmfKey(ns.aml.vocabularies.security.schemes, objectContext) as keyof SecurityRequirement]) as ParametrizedSecurityScheme[] | undefined;
1652
+ const schemes = (object[this._getAmfKey(ns.aml.vocabularies.security.schemes, objectContext) as keyof IAmfSecurityRequirement]) as IAmfParametrizedSecurityScheme[] | undefined;
1648
1653
  if (Array.isArray(schemes) && schemes.length) {
1649
1654
  result.schemes = schemes.map(p => this.parametrizedSecurityScheme(p, objectContext));
1650
1655
  }
1651
1656
  return result;
1652
1657
  }
1653
1658
 
1654
- securitySettings(object: Settings, context?: Record<string, string>): ApiSecuritySettingsUnion {
1659
+ securitySettings(object: IAmfSettings, context?: Record<string, string>): IApiSecuritySettingsUnion {
1655
1660
  const objectContext = context || object['@context'];
1656
1661
  const types = this.readTypes(object['@type'], objectContext);
1657
1662
  if (types.includes(ns.aml.vocabularies.security.OAuth1Settings)) {
1658
- return this.oAuth1Settings((object as OAuth1Settings), objectContext);
1663
+ return this.oAuth1Settings((object as IAmfOAuth1Settings), objectContext);
1659
1664
  }
1660
1665
  if (types.includes(ns.aml.vocabularies.security.OAuth2Settings)) {
1661
- return this.oAuth2Settings((object as OAuth2Settings), objectContext);
1666
+ return this.oAuth2Settings((object as IAmfOAuth2Settings), objectContext);
1662
1667
  }
1663
1668
  if (types.includes(ns.aml.vocabularies.security.ApiKeySettings)) {
1664
- return this.apiKeySettings((object as ApiKeySettings), objectContext);
1669
+ return this.apiKeySettings((object as IAmfApiKeySettings), objectContext);
1665
1670
  }
1666
1671
  if (types.includes(ns.aml.vocabularies.security.HttpSettings)) {
1667
- return this.httpSettings(object as HttpSettings, objectContext);
1672
+ return this.httpSettings(object as IAmfHttpSettings, objectContext);
1668
1673
  }
1669
1674
  if (types.includes(ns.aml.vocabularies.security.OpenIdConnectSettings)) {
1670
- return this.openIdConnectSettings(object as OpenIdConnectSettings, objectContext);
1675
+ return this.openIdConnectSettings(object as IAmfOpenIdConnectSettings, objectContext);
1671
1676
  }
1672
1677
  return this.settings(object, objectContext);
1673
1678
  }
1674
1679
 
1675
1680
  /**
1676
- * @param {Settings} object
1681
+ * @param {IAmfSettings} object
1677
1682
  * @param context
1678
- * @returns {ApiSecuritySettings}
1683
+ * @returns {IApiSecuritySettings}
1679
1684
  */
1680
- settings(object: Settings, context?: Record<string, string>): ApiSecuritySettings {
1685
+ settings(object: IAmfSettings, context?: Record<string, string>): IApiSecuritySettings {
1681
1686
  const objectContext = context || object['@context'];
1682
- const result: ApiSecuritySettings = ({
1687
+ const result: IApiSecuritySettings = ({
1683
1688
  id: object['@id'],
1684
1689
  types: this.readTypes(object['@type'], objectContext),
1685
1690
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1691,9 +1696,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1691
1696
  return result;
1692
1697
  }
1693
1698
 
1694
- oAuth1Settings(object: OAuth1Settings, context?: Record<string, string>): ApiSecurityOAuth1Settings {
1699
+ oAuth1Settings(object: IAmfOAuth1Settings, context?: Record<string, string>): IApiSecurityOAuth1Settings {
1695
1700
  const objectContext = context || object['@context'];
1696
- const result = (this.settings(object, objectContext)) as ApiSecurityOAuth1Settings;
1701
+ const result = (this.settings(object, objectContext)) as IApiSecurityOAuth1Settings;
1697
1702
 
1698
1703
  const authorizationUri = this._getValue(object, ns.aml.vocabularies.security.authorizationUri, objectContext);
1699
1704
  if (authorizationUri && typeof authorizationUri === 'string') {
@@ -1716,9 +1721,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1716
1721
  return result;
1717
1722
  }
1718
1723
 
1719
- oAuth2Settings(object: OAuth2Settings, context?: Record<string, string>): ApiSecurityOAuth2Settings {
1724
+ oAuth2Settings(object: IAmfOAuth2Settings, context?: Record<string, string>): IApiSecurityOAuth2Settings {
1720
1725
  const objectContext = context || object['@context'];
1721
- const result = this.settings(object, objectContext) as ApiSecurityOAuth2Settings;
1726
+ const result = this.settings(object, objectContext) as IApiSecurityOAuth2Settings;
1722
1727
 
1723
1728
  const grants = (this._getValueArray(object, ns.aml.vocabularies.security.authorizationGrant, objectContext)) as string[];
1724
1729
  if (Array.isArray(grants) && grants.length) {
@@ -1726,7 +1731,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1726
1731
  } else {
1727
1732
  result.authorizationGrants = [];
1728
1733
  }
1729
- const flows = (object[this._getAmfKey(ns.aml.vocabularies.security.flows, objectContext) as keyof OAuth2Settings]) as OAuth2Flow[] | undefined;
1734
+ const flows = (object[this._getAmfKey(ns.aml.vocabularies.security.flows, objectContext) as keyof IAmfOAuth2Settings]) as IAmfOAuth2Flow[] | undefined;
1730
1735
  if (Array.isArray(flows) && flows.length) {
1731
1736
  result.flows = flows.map((p) => this.oAuth2Flow(p, objectContext));
1732
1737
  } else {
@@ -1735,9 +1740,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1735
1740
  return result;
1736
1741
  }
1737
1742
 
1738
- oAuth2Flow(object: OAuth2Flow, context?: Record<string, string>): ApiSecurityOAuth2Flow {
1743
+ oAuth2Flow(object: IAmfOAuth2Flow, context?: Record<string, string>): IApiSecurityOAuth2Flow {
1739
1744
  const objectContext = context || object['@context'];
1740
- const result: ApiSecurityOAuth2Flow = ({
1745
+ const result: IApiSecurityOAuth2Flow = ({
1741
1746
  id: object['@id'],
1742
1747
  types: this.readTypes(object['@type'], objectContext),
1743
1748
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1761,16 +1766,16 @@ export class AmfSerializer extends AmfMixin(Object) {
1761
1766
  if (refreshUri && typeof refreshUri === 'string') {
1762
1767
  result.refreshUri = refreshUri;
1763
1768
  }
1764
- const scopes = object[this._getAmfKey(ns.aml.vocabularies.security.scope, objectContext) as keyof OAuth2Flow] as Scope[] | undefined;
1769
+ const scopes = object[this._getAmfKey(ns.aml.vocabularies.security.scope, objectContext) as keyof IAmfOAuth2Flow] as IAmfScope[] | undefined;
1765
1770
  if (Array.isArray(scopes) && scopes.length) {
1766
1771
  result.scopes = scopes.map((p) => this.scope(p, objectContext));
1767
1772
  }
1768
1773
  return result;
1769
1774
  }
1770
1775
 
1771
- scope(object: Scope, context?: Record<string, string>): ApiSecurityScope {
1776
+ scope(object: IAmfScope, context?: Record<string, string>): IApiSecurityScope {
1772
1777
  const objectContext = context || object['@context'];
1773
- const result: ApiSecurityScope = ({
1778
+ const result: IApiSecurityScope = ({
1774
1779
  id: object['@id'],
1775
1780
  types: this.readTypes(object['@type'], objectContext),
1776
1781
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1788,9 +1793,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1788
1793
  return result;
1789
1794
  }
1790
1795
 
1791
- apiKeySettings(object: ApiKeySettings, context?: Record<string, string>): ApiSecurityApiKeySettings {
1796
+ apiKeySettings(object: IAmfApiKeySettings, context?: Record<string, string>): IApiSecurityApiKeySettings {
1792
1797
  const objectContext = context || object['@context'];
1793
- const result = (this.settings(object, objectContext)) as ApiSecurityApiKeySettings;
1798
+ const result = (this.settings(object, objectContext)) as IApiSecurityApiKeySettings;
1794
1799
 
1795
1800
  const name = this._getValue(object, ns.aml.vocabularies.core.name, objectContext);
1796
1801
  if (name && typeof name === 'string') {
@@ -1803,9 +1808,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1803
1808
  return result;
1804
1809
  }
1805
1810
 
1806
- httpSettings(object: HttpSettings, context?: Record<string, string>): ApiSecurityHttpSettings {
1811
+ httpSettings(object: IAmfHttpSettings, context?: Record<string, string>): IApiSecurityHttpSettings {
1807
1812
  const objectContext = context || object['@context'];
1808
- const result = (this.settings(object, objectContext)) as ApiSecurityHttpSettings;
1813
+ const result = (this.settings(object, objectContext)) as IApiSecurityHttpSettings;
1809
1814
 
1810
1815
  const scheme = this._getValue(object, ns.aml.vocabularies.security.scheme, objectContext);
1811
1816
  if (scheme && typeof scheme === 'string') {
@@ -1818,9 +1823,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1818
1823
  return result;
1819
1824
  }
1820
1825
 
1821
- openIdConnectSettings(object: OpenIdConnectSettings, context?: Record<string, string>): ApiSecurityOpenIdConnectSettings {
1826
+ openIdConnectSettings(object: IAmfOpenIdConnectSettings, context?: Record<string, string>): IApiSecurityOpenIdConnectSettings {
1822
1827
  const objectContext = context || object['@context'];
1823
- const result = (this.settings(object, objectContext)) as ApiSecurityOpenIdConnectSettings;
1828
+ const result = (this.settings(object, objectContext)) as IApiSecurityOpenIdConnectSettings;
1824
1829
 
1825
1830
  const url = this._getValue(object, ns.aml.vocabularies.security.openIdConnectUrl, objectContext);
1826
1831
  if (url && typeof url === 'string') {
@@ -1832,55 +1837,55 @@ export class AmfSerializer extends AmfMixin(Object) {
1832
1837
  /**
1833
1838
  * Serializes source maps, when available.
1834
1839
  */
1835
- sourceMap(object: DocumentSourceMaps, context?: Record<string, string>): ApiDocumentSourceMaps|undefined {
1840
+ sourceMap(object: IAmfDocumentSourceMaps, context?: Record<string, string>): IApiDocumentSourceMaps|undefined {
1836
1841
  const objectContext = context || object['@context'];
1837
- let sm = object[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, objectContext) as keyof DocumentSourceMaps] as DocumentSourceMaps[] | DocumentSourceMaps | undefined;
1842
+ let sm = object[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfDocumentSourceMaps[] | IAmfDocumentSourceMaps | undefined;
1838
1843
  if (!sm) {
1839
1844
  return undefined;
1840
1845
  }
1841
1846
  if (Array.isArray(sm)) {
1842
1847
  [sm] = sm;
1843
1848
  }
1844
- const result: ApiDocumentSourceMaps = ({
1849
+ const result: IApiDocumentSourceMaps = ({
1845
1850
  id: sm['@id'],
1846
1851
  types: this.readTypes(sm['@type']),
1847
1852
  });
1848
- const synthesizedField = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.synthesizedField, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1853
+ const synthesizedField = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.synthesizedField, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1849
1854
  if (Array.isArray(synthesizedField) && synthesizedField.length) {
1850
1855
  result.synthesizedField = synthesizedField.map(i => this.synthesizedField(i, objectContext));
1851
1856
  }
1852
- const lexical = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.lexical, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1857
+ const lexical = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.lexical, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1853
1858
  if (Array.isArray(lexical) && lexical.length) {
1854
1859
  result.lexical = lexical.map(i => this.synthesizedField(i, objectContext))
1855
1860
  }
1856
- const trackedElement = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.trackedElement, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1861
+ const trackedElement = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.trackedElement, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1857
1862
  if (Array.isArray(trackedElement) && trackedElement.length) {
1858
1863
  result.trackedElement = this.synthesizedField(trackedElement[0], objectContext);
1859
1864
  }
1860
- const autoName = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.autoGeneratedName, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1865
+ const autoName = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.autoGeneratedName, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1861
1866
  if (Array.isArray(autoName) && autoName.length) {
1862
1867
  result.autoGeneratedName = autoName.map(i => this.synthesizedField(i, objectContext))
1863
1868
  }
1864
- const jsonSchema = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.parsedJsonSchema, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1869
+ const jsonSchema = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.parsedJsonSchema, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1865
1870
  if (Array.isArray(jsonSchema) && jsonSchema.length) {
1866
1871
  result.parsedJsonSchema = this.synthesizedField(jsonSchema[0], objectContext);
1867
1872
  }
1868
- const declaredElement = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.declaredElement, objectContext) as keyof DocumentSourceMaps] as SynthesizedField[] | undefined;
1873
+ const declaredElement = sm[this._getAmfKey(ns.aml.vocabularies.docSourceMaps.declaredElement, objectContext) as keyof IAmfDocumentSourceMaps] as IAmfSynthesizedField[] | undefined;
1869
1874
  if (Array.isArray(declaredElement) && declaredElement.length) {
1870
1875
  result.declaredElement = this.synthesizedField(declaredElement[0], objectContext);
1871
1876
  }
1872
1877
  return result;
1873
1878
  }
1874
1879
 
1875
- synthesizedField(object: SynthesizedField, context?: Record<string, string>): ApiSynthesizedField {
1880
+ synthesizedField(object: IAmfSynthesizedField, context?: Record<string, string>): IApiSynthesizedField {
1876
1881
  // compact model
1877
1882
  if (typeof object === 'string') {
1878
1883
  return {
1879
1884
  id: 'synthesizedField/generated',
1880
1885
  value: object,
1881
- } as ApiSynthesizedField;
1886
+ } as IApiSynthesizedField;
1882
1887
  }
1883
- const result: ApiSynthesizedField = {
1888
+ const result: IApiSynthesizedField = {
1884
1889
  id: object['@id'],
1885
1890
  value: '',
1886
1891
  };
@@ -1895,9 +1900,9 @@ export class AmfSerializer extends AmfMixin(Object) {
1895
1900
  return result;
1896
1901
  }
1897
1902
 
1898
- parametrizedDeclaration(object: ParametrizedDeclaration, context?: Record<string, string>): ApiParametrizedDeclaration {
1903
+ parametrizedDeclaration(object: IAmfParametrizedDeclaration, context?: Record<string, string>): IApiParametrizedDeclaration {
1899
1904
  const objectContext = context || object['@context'];
1900
- const result: ApiParametrizedDeclaration = ({
1905
+ const result: IApiParametrizedDeclaration = ({
1901
1906
  id: object['@id'],
1902
1907
  types: this.readTypes(object['@type'], objectContext),
1903
1908
  variables: [],
@@ -1909,13 +1914,13 @@ export class AmfSerializer extends AmfMixin(Object) {
1909
1914
  if (name && typeof name === 'string') {
1910
1915
  result.name = name;
1911
1916
  }
1912
- const variables = object[this._getAmfKey(ns.aml.vocabularies.document.variable, objectContext) as keyof ParametrizedDeclaration] as VariableValue[] | undefined;
1917
+ const variables = object[this._getAmfKey(ns.aml.vocabularies.document.variable, objectContext) as keyof IAmfParametrizedDeclaration] as IAmfVariableValue[] | undefined;
1913
1918
  if (Array.isArray(variables)) {
1914
1919
  variables.forEach((item) => {
1915
1920
  result.variables.push(this.variableValue(item, objectContext));
1916
1921
  });
1917
1922
  }
1918
- const targets = object[this._getAmfKey(ns.aml.vocabularies.document.target, objectContext) as keyof ParametrizedDeclaration] as AbstractDeclaration[] | undefined;
1923
+ const targets = object[this._getAmfKey(ns.aml.vocabularies.document.target, objectContext) as keyof IAmfParametrizedDeclaration] as IAmfAbstractDeclaration[] | undefined;
1919
1924
  if (Array.isArray(targets) && targets.length) {
1920
1925
  const [target] = targets;
1921
1926
  result.target = this.abstractDeclaration(target, objectContext);
@@ -1923,30 +1928,30 @@ export class AmfSerializer extends AmfMixin(Object) {
1923
1928
  return result;
1924
1929
  }
1925
1930
 
1926
- parametrizedTrait(object: ParametrizedTrait, context?: Record<string, string>): ApiParametrizedTrait {
1931
+ parametrizedTrait(object: IAmfParametrizedTrait, context?: Record<string, string>): IApiParametrizedTrait {
1927
1932
  const objectContext = context || object['@context'];
1928
- const result = (this.parametrizedDeclaration(object, objectContext)) as ApiParametrizedTrait;
1933
+ const result = (this.parametrizedDeclaration(object, objectContext)) as IApiParametrizedTrait;
1929
1934
  return result;
1930
1935
  }
1931
1936
 
1932
- parametrizedResourceType(object: ParametrizedResourceType, context?: Record<string, string>): ApiParametrizedResourceType {
1937
+ parametrizedResourceType(object: IAmfParametrizedResourceType, context?: Record<string, string>): IApiParametrizedResourceType {
1933
1938
  const objectContext = context || object['@context'];
1934
- const result = (this.parametrizedDeclaration(object, objectContext)) as ApiParametrizedResourceType;
1939
+ const result = (this.parametrizedDeclaration(object, objectContext)) as IApiParametrizedResourceType;
1935
1940
  return result;
1936
1941
  }
1937
1942
 
1938
- variableValue(object: VariableValue, context?: Record<string, string>): ApiVariableValue {
1943
+ variableValue(object: IAmfVariableValue, context?: Record<string, string>): IApiVariableValue {
1939
1944
  const objectContext = context || object['@context'];
1940
1945
 
1941
1946
  const name = this._getValue(object, ns.aml.vocabularies.core.name, objectContext) as string;
1942
- const result: ApiVariableValue = ({
1947
+ const result: IApiVariableValue = ({
1943
1948
  id: object['@id'],
1944
1949
  types: this.readTypes(object['@type'], objectContext),
1945
1950
  customDomainProperties: this.customDomainProperties(object, objectContext),
1946
1951
  sourceMaps: this.sourceMap(object, objectContext),
1947
1952
  name,
1948
1953
  });
1949
- const values = object[this._getAmfKey(ns.aml.vocabularies.document.value, objectContext) as keyof VariableValue] as DataNode[] | undefined;
1954
+ const values = object[this._getAmfKey(ns.aml.vocabularies.document.value, objectContext) as keyof IAmfVariableValue] as IAmfDataNode[] | undefined;
1950
1955
  if (Array.isArray(values)) {
1951
1956
  const [item] = values;
1952
1957
  result.value = this.unknownDataNode(item, objectContext);
@@ -1954,11 +1959,11 @@ export class AmfSerializer extends AmfMixin(Object) {
1954
1959
  return result;
1955
1960
  }
1956
1961
 
1957
- abstractDeclaration(object: AbstractDeclaration, context?: Record<string, string>): ApiAbstractDeclaration {
1962
+ abstractDeclaration(object: IAmfAbstractDeclaration, context?: Record<string, string>): IApiAbstractDeclaration {
1958
1963
  const objectContext = context || object['@context'];
1959
1964
 
1960
1965
  const name = this._getValue(object, ns.aml.vocabularies.core.name, objectContext) as string;
1961
- const result: ApiAbstractDeclaration = ({
1966
+ const result: IApiAbstractDeclaration = ({
1962
1967
  id: object['@id'],
1963
1968
  types: this.readTypes(object['@type'], objectContext),
1964
1969
  customDomainProperties: this.customDomainProperties(object, objectContext),
@@ -1974,7 +1979,7 @@ export class AmfSerializer extends AmfMixin(Object) {
1974
1979
  if (description && typeof description === 'string') {
1975
1980
  result.description = description;
1976
1981
  }
1977
- const dataNode = object[this._getAmfKey(ns.aml.vocabularies.document.dataNode, objectContext) as keyof AbstractDeclaration] as DataNode[] | undefined;
1982
+ const dataNode = object[this._getAmfKey(ns.aml.vocabularies.document.dataNode, objectContext) as keyof IAmfAbstractDeclaration] as IAmfDataNode[] | undefined;
1978
1983
  if (Array.isArray(dataNode)) {
1979
1984
  const [item] = dataNode;
1980
1985
  result.dataNode = this.unknownDataNode(item, objectContext);
@@ -1986,14 +1991,14 @@ export class AmfSerializer extends AmfMixin(Object) {
1986
1991
  * @param object The EndPoint to serialize as a list item.
1987
1992
  * @returns Serialized EndPoint as a list item.
1988
1993
  */
1989
- endPointWithOperationsListItem(object: EndPoint, context?: Record<string, string>): ApiEndPointWithOperationsListItem {
1994
+ endPointWithOperationsListItem(object: IAmfEndPoint, context?: Record<string, string>): IApiEndPointWithOperationsListItem {
1990
1995
  const path = this._getValue(object, ns.aml.vocabularies.apiContract.path, context) as string;
1991
- const result: ApiEndPointWithOperationsListItem = ({
1996
+ const result: IApiEndPointWithOperationsListItem = ({
1992
1997
  id: object['@id'],
1993
1998
  path,
1994
1999
  operations: [],
1995
2000
  });
1996
- const operations = this[getArrayItems](object, ns.aml.vocabularies.apiContract.supportedOperation, context) as Operation[] | undefined;
2001
+ const operations = this[getArrayItems](object, ns.aml.vocabularies.apiContract.supportedOperation, context) as IAmfOperation[] | undefined;
1997
2002
  if (Array.isArray(operations) && operations.length) {
1998
2003
  result.operations = operations.map(i => this.operationListItem(i, context));
1999
2004
  }
@@ -2009,8 +2014,8 @@ export class AmfSerializer extends AmfMixin(Object) {
2009
2014
  * @param context A context to use. If not set, it looks for the context of the passed model
2010
2015
  * @returns Serialized Operation as a list item.
2011
2016
  */
2012
- operationListItem(object: Operation, context?: Record<string, string>): ApiOperationListItem {
2013
- const result: ApiOperationListItem = ({
2017
+ operationListItem(object: IAmfOperation, context?: Record<string, string>): IApiOperationListItem {
2018
+ const result: IApiOperationListItem = ({
2014
2019
  id: object['@id'],
2015
2020
  method: '',
2016
2021
  });