@api-client/core 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.d.ts +5 -4
- package/build/browser.js +1 -0
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +5 -4
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/oauth-popup.html +29 -0
- package/build/src/amf/AmfMixin.d.ts +2 -1
- package/build/src/amf/AmfMixin.js.map +1 -1
- package/build/src/amf/AmfShapeGenerator.d.ts +2 -0
- package/build/src/amf/AmfShapeGenerator.js +2 -0
- package/build/src/amf/AmfShapeGenerator.js.map +1 -1
- package/build/src/amf/ApiSchemaValues.d.ts +4 -4
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/amf/Utils.js +3 -1
- package/build/src/amf/Utils.js.map +1 -1
- package/build/src/amf/data-node/XmlDataNodeGenerator.js +2 -1
- package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts +1 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +4 -2
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +13 -13
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +25 -7
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
- package/build/src/authorization/OAuth2Authorization.d.ts +4 -4
- package/build/src/authorization/OAuth2Authorization.js +7 -7
- package/build/src/authorization/OAuth2Authorization.js.map +1 -1
- package/build/src/authorization/OidcAuthorization.js +0 -1
- package/build/src/authorization/OidcAuthorization.js.map +1 -1
- package/build/src/data/XmlReader.js +2 -0
- package/build/src/data/XmlReader.js.map +1 -1
- package/build/src/events/CustomEvent.d.ts +1 -1
- package/build/src/events/CustomEvent.js +1 -1
- package/build/src/lib/logging/DefaultLogger.js +1 -0
- package/build/src/lib/logging/DefaultLogger.js.map +1 -1
- package/build/src/lib/parsers/UriTemplate.js +1 -1
- package/build/src/lib/parsers/UrlEncoder.js +1 -0
- package/build/src/lib/parsers/UrlEncoder.js.map +1 -1
- package/build/src/lib/timers/Timers.d.ts +9 -0
- package/build/src/lib/timers/Timers.js +13 -0
- package/build/src/lib/timers/Timers.js.map +1 -1
- package/build/src/mocking/LegacyInterfaces.d.ts +1 -2
- package/build/src/mocking/LegacyMock.js +0 -1
- package/build/src/mocking/LegacyMock.js.map +1 -1
- package/build/src/mocking/legacy/Http.js +1 -1
- package/build/src/mocking/legacy/Http.js.map +1 -1
- package/build/src/models/data/DataNamespace.d.ts +0 -1
- package/build/src/models/data/DataNamespace.js +1 -1
- package/build/src/models/data/DataNamespace.js.map +1 -1
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/models/transformers/ArcLegacyTransformer.js +1 -0
- package/build/src/models/transformers/ArcLegacyTransformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV21Transformer.d.ts +1 -2
- package/build/src/models/transformers/PostmanV21Transformer.js +2 -0
- package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV2Transformer.js +2 -0
- package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
- package/build/src/runtime/store/AuthSdk.js +1 -0
- package/build/src/runtime/store/AuthSdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/testing/TestCliHelper.js.map +1 -1
- package/data/apis/APIC-187/APIC-187.raml +21 -0
- package/data/apis/APIC-187/dataType.raml +132 -0
- package/data/apis/APIC-187/example.raml +84 -0
- package/data/apis/APIC-188/APIC-188.raml +21 -0
- package/data/apis/APIC-188/dataType.raml +132 -0
- package/data/apis/APIC-188/example.raml +84 -0
- package/data/apis/APIC-233/APIC-233.raml +15 -0
- package/data/apis/APIC-391/APIC-391.raml +44 -0
- package/data/apis/APIC-391/examples/post-body-request-example.raml +7 -0
- package/data/apis/APIC-487/APIC-487.raml +36 -0
- package/data/apis/APIC-655/APIC-655.raml +44 -0
- package/data/apis/APIC-655/delivery.json +12 -0
- package/data/apis/APIC-689/APIC-689.raml +20 -0
- package/data/apis/APIC-690/APIC-690.raml +17 -0
- package/data/apis/APIC-690/datatypes/Address.raml +10 -0
- package/data/apis/APIC-690/datatypes/Customer.raml +17 -0
- package/data/apis/APIC-690/examples/CustomerExample2.raml +17 -0
- package/data/apis/APIC-690/examples/CustomersExample.raml +34 -0
- package/data/apis/SE-10469/Purchase-Order-oagis-id-dd32f9c6c01048a19e15c423c9c741ae.json +1383 -0
- package/data/apis/SE-10469/SE-10469.raml +11 -0
- package/data/apis/SE-13092/Examples/PersonExample.raml +7 -0
- package/data/apis/SE-13092/SE-13092.raml +37 -0
- package/data/apis/SE-13092/datatypes/Address.raml +5 -0
- package/data/apis/SE-13092/datatypes/InlineType.raml +5 -0
- package/data/apis/SE-13092/datatypes/Person.raml +15 -0
- package/data/apis/SE-22063/SE-22063.raml +14 -0
- package/data/apis/SE-22063/stock.raml +41 -0
- package/data/apis/amf-helper-api/amf-helper-api.raml +1024 -0
- package/data/apis/amf-helper-api/examples/comment-example.json +42 -0
- package/data/apis/amf-helper-api/examples/commentCreateRequest-example.json +7 -0
- package/data/apis/amf-helper-api/examples/commentList-example.json +48 -0
- package/data/apis/amf-helper-api/examples/person.json +14 -0
- package/data/apis/amf-helper-api/examples/person.raml +13 -0
- package/data/apis/amf-helper-api/examples/person.xml +14 -0
- package/data/apis/amf-helper-api/libraries/comment-lib.raml +143 -0
- package/data/apis/amf-helper-api/library.raml +7 -0
- package/data/apis/amf-helper-api/schemas/person.json +104 -0
- package/data/apis/amf-helper-api/schemas/person.xsd +26 -0
- package/data/apis/amf-helper-api/traits/file.raml +33 -0
- package/data/apis/amf-helper-api/traits/pagination.raml +80 -0
- package/data/apis/amf-helper-api/traits/results.raml +19 -0
- package/data/apis/amf-helper-api/traits/visibility.raml +14 -0
- package/data/apis/amf-helper-api/types/app-person.raml +101 -0
- package/data/apis/amf-helper-api/types/dimensions.raml +24 -0
- package/data/apis/amf-helper-api/types/external-type.raml +7 -0
- package/data/apis/amf-helper-api/types/image.raml +23 -0
- package/data/apis/amf-helper-api/types/product.raml +52 -0
- package/data/apis/amf-helper-api/types/resource.raml +11 -0
- package/data/apis/amf-helper-api/types/standard-request.raml +50 -0
- package/data/apis/amf-helper-api/types/user.raml +37 -0
- package/data/apis/async-api/async-api.yaml +96 -0
- package/data/apis/example-generator-api/contact-email-example.raml +6 -0
- package/data/apis/example-generator-api/contact-example.raml +5 -0
- package/data/apis/example-generator-api/contact-fax-example.raml +5 -0
- package/data/apis/example-generator-api/contact-website-example.raml +2 -0
- package/data/apis/example-generator-api/example-1.raml +6 -0
- package/data/apis/example-generator-api/example-2.raml +9 -0
- package/data/apis/example-generator-api/example-3.raml +4 -0
- package/data/apis/example-generator-api/example-4.raml +2 -0
- package/data/apis/example-generator-api/example-5.raml +4 -0
- package/data/apis/example-generator-api/example-6.raml +2 -0
- package/data/apis/example-generator-api/example-7.raml +5 -0
- package/data/apis/example-generator-api/example-generator-api.raml +423 -0
- package/data/apis/example-generator-api/example.json +14 -0
- package/data/apis/example-generator-api/example.xml +15 -0
- package/data/apis/example-generator-api/example.xsd +26 -0
- package/data/apis/example-generator-api/examples/employee.raml +7 -0
- package/data/apis/example-generator-api/examples/employees.raml +7 -0
- package/data/apis/example-generator-api/linked-named-example.raml +21 -0
- package/data/apis/example-generator-api/named-example-with-link.raml +5 -0
- package/data/apis/example-generator-api/named-example.raml +9 -0
- package/data/apis/example-generator-api/user-json-example.raml +17 -0
- package/data/apis/example-generator-api/user-raml-example.raml +37 -0
- package/data/apis/example-generator-api/user.json +8 -0
- package/data/apis/example-generator-api/user.raml +18 -0
- package/data/apis/example-generator-api/users-json-example.raml +17 -0
- package/data/apis/example-generator-api/users-raml-example.raml +32 -0
- package/data/apis/example-generator-api/users.json +8 -0
- package/data/apis/expanded-api/expanded-api.raml +8 -0
- package/data/apis/flattened-api/flattened-api.raml +8 -0
- package/data/apis/multiple-servers/multiple-servers.yaml +112 -0
- package/data/apis/schema-api/schema-api.raml +13 -1
- package/data/apis/tracked-examples/datatypes/employee.raml +5 -0
- package/data/apis/tracked-examples/examples/employee.raml +4 -0
- package/data/apis/tracked-examples/examples/employees.raml +8 -0
- package/data/apis/tracked-examples/tracked-to-linked.raml +28 -0
- package/data/model.js +19 -0
- package/data/models/APIC-187.json +11398 -0
- package/data/models/APIC-188.json +11398 -0
- package/data/models/APIC-233.json +539 -0
- package/data/models/APIC-391.json +1872 -0
- package/data/models/APIC-487.json +1225 -0
- package/data/models/APIC-655.json +3109 -0
- package/data/models/APIC-689.json +761 -0
- package/data/models/APIC-690.json +5992 -0
- package/data/models/SE-10469.json +22882 -0
- package/data/models/SE-13092.json +2715 -0
- package/data/models/SE-22063.json +2276 -0
- package/data/models/amf-helper-api.json +85908 -0
- package/data/models/async-api.json +3108 -0
- package/data/models/example-generator-api.json +44978 -0
- package/data/models/expanded-api.json +251 -0
- package/data/models/flattened-api.json +251 -0
- package/data/models/multiple-servers.json +2753 -0
- package/data/models/schema-api.json +436 -428
- package/data/models/tracked-to-linked.json +1790 -0
- package/package.json +6 -5
- package/src/amf/AmfMixin.ts +3 -2
- package/src/amf/AmfShapeGenerator.ts +5 -3
- package/src/amf/ApiSchemaValues.ts +5 -5
- package/src/amf/Utils.ts +6 -4
- package/src/amf/data-node/XmlDataNodeGenerator.ts +2 -1
- package/src/amf/shape/ShapeBase.ts +1 -1
- package/src/amf/shape/ShapeJsonSchemaGenerator.ts +4 -2
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +85 -66
- package/src/authorization/OAuth2Authorization.ts +33 -32
- package/src/authorization/OidcAuthorization.ts +3 -4
- package/src/data/XmlReader.ts +7 -5
- package/src/events/CustomEvent.ts +1 -1
- package/src/lib/logging/DefaultLogger.ts +1 -0
- package/src/lib/parsers/UriTemplate.ts +1 -1
- package/src/lib/parsers/UrlEncoder.ts +1 -0
- package/src/lib/timers/Timers.ts +14 -0
- package/src/mocking/LegacyInterfaces.ts +1 -2
- package/src/mocking/LegacyMock.ts +0 -1
- package/src/mocking/legacy/Http.ts +1 -1
- package/src/models/data/DataNamespace.ts +2 -2
- package/src/models/store/Permission.ts +1 -1
- package/src/models/transformers/ArcLegacyTransformer.ts +1 -0
- package/src/models/transformers/PostmanV21Transformer.ts +3 -2
- package/src/models/transformers/PostmanV2Transformer.ts +2 -0
- package/src/runtime/store/AuthSdk.ts +1 -0
- package/src/runtime/store/SdkBase.ts +1 -0
- package/src/testing/TestCliHelper.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-client/core",
|
|
3
3
|
"description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/cors": "^2.8.12",
|
|
33
33
|
"@types/express-ntlm": "^2.3.3",
|
|
34
34
|
"@types/fs-extra": "^9.0.13",
|
|
35
|
-
"@types/mocha": "^
|
|
35
|
+
"@types/mocha": "^10.0.0",
|
|
36
36
|
"@types/node": "^18.7.18",
|
|
37
37
|
"@types/sinon": "^10.0.11",
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@web/dev-server-esbuild": "^0.3.0",
|
|
41
41
|
"@web/test-runner": "^0.14.0",
|
|
42
42
|
"@web/test-runner-playwright": "^0.8.8",
|
|
43
|
-
"amf-client-js": "^5.
|
|
43
|
+
"amf-client-js": "^5.1.0",
|
|
44
44
|
"chai": "^4.3.4",
|
|
45
45
|
"chai-as-promised": "^7.1.1",
|
|
46
46
|
"chai-uuid": "^1.0.6",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build-ts": "tsc",
|
|
70
|
-
"build": "npm run build-ts && npm run lint",
|
|
70
|
+
"build": "npm run build-ts && npm run lint && npm run copy:assets",
|
|
71
71
|
"lint": "tsc --noEmit && eslint \"**/*.{js,ts}\" --quiet --fix",
|
|
72
72
|
"prepare": "husky install && npm run build-ts && npm run build:api-models",
|
|
73
73
|
"tsc:watch": "tsc --watch",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
"test:browser:watch": "wtr --watch --playwright --browsers chromium",
|
|
76
76
|
"test:node": "npm run build-ts && mocha",
|
|
77
77
|
"test": "npm run test:node && npm run test:browser",
|
|
78
|
-
"build:api-models": "node data/model.js"
|
|
78
|
+
"build:api-models": "node data/model.js",
|
|
79
|
+
"copy:assets": "cp -f ./oauth-popup.html ./build/oauth-popup.html"
|
|
79
80
|
},
|
|
80
81
|
"husky": {
|
|
81
82
|
"hooks": {
|
package/src/amf/AmfMixin.ts
CHANGED
|
@@ -57,6 +57,7 @@ type Constructor<T = {}> = new (...args: any[]) => T;
|
|
|
57
57
|
|
|
58
58
|
export declare class AmfMixinInterface {
|
|
59
59
|
amf?: IAmfDocument;
|
|
60
|
+
_amf?: IAmfDocument;
|
|
60
61
|
/**
|
|
61
62
|
* This is an abstract method to be implemented by the components.
|
|
62
63
|
* If, instead, the component uses `amf` setter you must use `super.amf` to
|
|
@@ -254,7 +255,7 @@ export declare class AmfMixinInterface {
|
|
|
254
255
|
* to read servers
|
|
255
256
|
* @private
|
|
256
257
|
*/
|
|
257
|
-
_isValidServerPartial(model: IAmfDomainElement, context?: Record<string, string>): boolean;
|
|
258
|
+
_isValidServerPartial(model: IAmfDomainElement | IAmfDomainElement[], context?: Record<string, string>): boolean;
|
|
258
259
|
|
|
259
260
|
/**
|
|
260
261
|
* @param options Server query options
|
|
@@ -957,7 +958,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
|
|
|
957
958
|
* to read servers
|
|
958
959
|
* @private
|
|
959
960
|
*/
|
|
960
|
-
_isValidServerPartial(model: IAmfDomainElement, context?: Record<string, string>): boolean {
|
|
961
|
+
_isValidServerPartial(model: IAmfDomainElement | IAmfDomainElement[], context?: Record<string, string>): boolean {
|
|
961
962
|
if (Array.isArray(model)) {
|
|
962
963
|
[model] = model;
|
|
963
964
|
}
|
|
@@ -10,6 +10,8 @@ import v4 from '../lib/uuid.js';
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Serializes Data shapes (DataEntity, DataProperty, DataAssociation) to AMF-related shapes.
|
|
13
|
+
*
|
|
14
|
+
* This is used when defining entities (according to the `DataEntity` schema) and then we want to translate this into AMF shapes.
|
|
13
15
|
*/
|
|
14
16
|
export class AmfShapeGenerator {
|
|
15
17
|
/**
|
|
@@ -73,8 +75,8 @@ export class AmfShapeGenerator {
|
|
|
73
75
|
this._updateBaseProperties(input, result);
|
|
74
76
|
|
|
75
77
|
// sync the name of the property shape with the range, in case it was changed by the bindings
|
|
76
|
-
if (result.range
|
|
77
|
-
result.name = result.range
|
|
78
|
+
if (result.range.name) {
|
|
79
|
+
result.name = result.range.name;
|
|
78
80
|
}
|
|
79
81
|
return result;
|
|
80
82
|
}
|
|
@@ -382,7 +384,7 @@ export class AmfShapeGenerator {
|
|
|
382
384
|
*/
|
|
383
385
|
refactorArrayToShape(array: IApiArrayShape): IShapeUnion {
|
|
384
386
|
const { items } = array;
|
|
385
|
-
return items
|
|
387
|
+
return items as IShapeUnion;
|
|
386
388
|
}
|
|
387
389
|
|
|
388
390
|
/**
|
|
@@ -27,7 +27,7 @@ export class ApiSchemaValues {
|
|
|
27
27
|
*
|
|
28
28
|
* @returns The value to set on the input. Note, it is not cast to the type.
|
|
29
29
|
*/
|
|
30
|
-
static readInputValue(parameter: IApiParameter, schema: IApiScalarShape, opts: IApiSchemaReadOptions = {}):
|
|
30
|
+
static readInputValue(parameter: IApiParameter, schema: IApiScalarShape, opts: IApiSchemaReadOptions = {}): string | number | boolean | null | undefined {
|
|
31
31
|
const { required } = parameter;
|
|
32
32
|
const { defaultValueStr, values } = schema;
|
|
33
33
|
if (!required && opts.requiredOnly === true) {
|
|
@@ -180,7 +180,7 @@ export class ApiSchemaValues {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
static defaultValue(dataType?: string):
|
|
183
|
+
static defaultValue(dataType?: string): string | number | boolean | null | undefined {
|
|
184
184
|
switch (dataType) {
|
|
185
185
|
case ns.w3.xmlSchema.string: return '';
|
|
186
186
|
// XML schema, for DataNode
|
|
@@ -287,7 +287,7 @@ export class ApiSchemaValues {
|
|
|
287
287
|
* Casts the `value` to the corresponding data type
|
|
288
288
|
* @param type The w3 schema type
|
|
289
289
|
*/
|
|
290
|
-
static readTypedValue(value:
|
|
290
|
+
static readTypedValue(value: unknown, type?: string): string | number | boolean | null | undefined {
|
|
291
291
|
return readTypedValue(value, type);
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -334,8 +334,8 @@ export class ApiSchemaValues {
|
|
|
334
334
|
/**
|
|
335
335
|
* Processes a value that should be a date formatted as yyyy-MM-dd.
|
|
336
336
|
*/
|
|
337
|
-
static parseDateOnlyInput(value:
|
|
338
|
-
const d = new Date(value);
|
|
337
|
+
static parseDateOnlyInput(value: unknown): string | undefined {
|
|
338
|
+
const d = new Date(value as string | number);
|
|
339
339
|
if (Number.isNaN(d.getTime())) {
|
|
340
340
|
return undefined;
|
|
341
341
|
}
|
package/src/amf/Utils.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IApiNodeShape, IApiPropertyShape, IShapeUnion, IApiUnionShape } from ".
|
|
|
5
5
|
/**
|
|
6
6
|
* @param indent The current indent
|
|
7
7
|
*/
|
|
8
|
-
export function toXml(obj: Record<string, unknown>, indent=0): string {
|
|
8
|
+
export function toXml(obj: Record<string, unknown>, indent = 0): string {
|
|
9
9
|
if (typeof obj !== 'object') {
|
|
10
10
|
return obj;
|
|
11
11
|
}
|
|
@@ -15,14 +15,16 @@ export function toXml(obj: Record<string, unknown>, indent=0): string {
|
|
|
15
15
|
xml += Array.isArray(obj[prop]) ? '' : `${tabs}<${prop}>`;
|
|
16
16
|
if (Array.isArray(obj[prop])) {
|
|
17
17
|
(obj[prop] as Record<string, unknown>[]).forEach((item) => {
|
|
18
|
-
xml += `<${prop}>\n`;
|
|
19
18
|
xml += tabs;
|
|
19
|
+
xml += `<${prop}>\n`;
|
|
20
20
|
xml += toXml({ ...item }, indent + 1);
|
|
21
|
+
xml += tabs;
|
|
21
22
|
xml += `</${prop}>\n`;
|
|
22
23
|
});
|
|
23
24
|
} else if (typeof obj[prop] === "object") {
|
|
24
25
|
xml += `\n`;
|
|
25
26
|
xml += toXml({ ...obj[prop] as Record<string, unknown> }, indent + 1);
|
|
27
|
+
xml += tabs;
|
|
26
28
|
} else {
|
|
27
29
|
xml += `${obj[prop]}`;
|
|
28
30
|
}
|
|
@@ -113,7 +115,7 @@ export function readTypedValue(value: unknown, type?: string): string | null | n
|
|
|
113
115
|
case AmfNamespace.aml.vocabularies.shapes.boolean:
|
|
114
116
|
case AmfNamespace.w3.xmlSchema.boolean: return parseBooleanInput(value, false);
|
|
115
117
|
case AmfNamespace.aml.vocabularies.shapes.nil:
|
|
116
|
-
case AmfNamespace.w3.xmlSchema.nil:
|
|
118
|
+
case AmfNamespace.w3.xmlSchema.nil:
|
|
117
119
|
return null;
|
|
118
120
|
default:
|
|
119
121
|
return value as string | null | number | boolean | undefined;
|
|
@@ -152,7 +154,7 @@ export function collectNodeProperties(schema: IApiNodeShape, selectedUnions?: st
|
|
|
152
154
|
let node = s;
|
|
153
155
|
if (node.types.includes(AmfNamespace.aml.vocabularies.shapes.UnionShape)) {
|
|
154
156
|
const union = node as IApiUnionShape;
|
|
155
|
-
const { anyOf=[] } = union;
|
|
157
|
+
const { anyOf = [] } = union;
|
|
156
158
|
node = getUnionMember(anyOf, selectedUnions);
|
|
157
159
|
}
|
|
158
160
|
if (!node.types.includes(AmfNamespace.w3.shacl.NodeShape)) {
|
|
@@ -31,7 +31,8 @@ export class XmlDataNodeGenerator extends DataNodeBase {
|
|
|
31
31
|
if (Array.isArray(result)) {
|
|
32
32
|
return result.map(v => `${tabs}<${shapeName}>${toXml(v)}</${shapeName}>`).filter(v => !!v).join('\n');
|
|
33
33
|
}
|
|
34
|
-
return `${tabs}<${shapeName}>${toXml(result)}</${shapeName}>`;
|
|
34
|
+
// return `${tabs}<${shapeName}>${toXml(result)}</${shapeName}>`;
|
|
35
|
+
return `${toXml({ [shapeName]: result })}`;
|
|
35
36
|
}
|
|
36
37
|
return `${toXml(result, indent)}`;
|
|
37
38
|
}
|
|
@@ -42,7 +42,7 @@ export abstract class ShapeBase {
|
|
|
42
42
|
this.opts = Object.freeze({ ...opts });
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
protected _scalarValue(schema: IApiScalarShape): string | number | boolean {
|
|
45
|
+
protected _scalarValue(schema: IApiScalarShape): string | number | boolean | null | undefined {
|
|
46
46
|
const { defaultValue, examples, values, inherits, dataType } = schema;
|
|
47
47
|
// check examples
|
|
48
48
|
if (this.opts.renderExamples && examples && examples.length) {
|
|
@@ -155,7 +155,8 @@ export class ShapeJsonSchemaGenerator extends ShapeBase {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
protected _oneOfUnion(schema: IApiUnionShape): any {
|
|
158
|
-
let {
|
|
158
|
+
let { examples=[] } = schema;
|
|
159
|
+
const { xone=[] } = schema;
|
|
159
160
|
if (Array.isArray(schema.inherits) && schema.inherits) {
|
|
160
161
|
schema.inherits.forEach((parent) => {
|
|
161
162
|
const anyParent = parent as IApiAnyShape;
|
|
@@ -192,7 +193,8 @@ export class ShapeJsonSchemaGenerator extends ShapeBase {
|
|
|
192
193
|
* Combines all properties from both all shapes in the union
|
|
193
194
|
*/
|
|
194
195
|
protected _allOfUnion(schema: IApiUnionShape): any {
|
|
195
|
-
let { examples=[]
|
|
196
|
+
let { examples=[] } = schema;
|
|
197
|
+
const { and=[] } = schema;
|
|
196
198
|
if (Array.isArray(schema.inherits) && schema.inherits) {
|
|
197
199
|
schema.inherits.forEach((parent) => {
|
|
198
200
|
const anyParent = parent as IApiAnyShape;
|