Skip to content

Commit ecbd8c5

Browse files
authored
Merge pull request #64 from advanced-rest-client/fix/W-14874965/-swagger-Json-file-not-displaying-valid-Json-examples-in-response-in-Design-center-and-Exchange
[W-14874965] Swagger-Json-file-not-displaying-valid-Json-examples-in-response-in-Design-center-and-Exchange
2 parents 2866595 + 77fc0fe commit ecbd8c5

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@api-components/api-example-generator",
33
"description": "Examples generator from AMF model",
4-
"version": "4.4.27",
4+
"version": "4.4.28",
55
"license": "Apache-2.0",
66
"main": "index.js",
77
"module": "index.js",
@@ -26,7 +26,7 @@
2626
"email": "[email protected]"
2727
},
2828
"dependencies": {
29-
"@api-components/amf-helper-mixin": "^4.1.8",
29+
"@api-components/amf-helper-mixin": "^4.5.24",
3030
"lit-element": "^2.4.0"
3131
},
3232
"devDependencies": {

src/ExampleGenerator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,9 +1635,17 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
16351635
_computeJsonObjectValue(range) {
16361636
const pKey = this._getAmfKey(this.ns.w3.shacl.property);
16371637
const properties = this._ensureArray(range[pKey]);
1638+
1639+
const additionalPropertiesKey = this._getAmfKey(this.ns.w3.shacl.additionalPropertiesSchema);
1640+
const additionalProperties = this._ensureArray(range[additionalPropertiesKey]);
1641+
16381642
if (properties && properties.length) {
16391643
return this._jsonExampleFromProperties(properties);
16401644
}
1645+
if (additionalProperties && additionalProperties.length) {
1646+
return this._jsonExampleFromProperties(this._ensureArray(additionalProperties[0][pKey]));
1647+
}
1648+
16411649
return {};
16421650
}
16431651

0 commit comments

Comments
 (0)