@api-components/api-type-document 4.2.38 → 4.2.39
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/package.json +1 -1
- package/src/ApiTypeDocument.js +6 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-components/api-type-document",
|
|
3
3
|
"description": "A documentation table for type (resource) properties. Works with AMF data model",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.39",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.js",
|
package/src/ApiTypeDocument.js
CHANGED
|
@@ -391,6 +391,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
391
391
|
this._showExamples = !this.noMainExample && (
|
|
392
392
|
this.renderMediaSelector ||
|
|
393
393
|
this.isObject ||
|
|
394
|
+
this.isArray ||
|
|
394
395
|
this._renderMainExample
|
|
395
396
|
);
|
|
396
397
|
}
|
|
@@ -530,15 +531,16 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
// Determine if we should show the examples section
|
|
533
|
-
// Priority: noMainExample (hide) > renderMediaSelector (show) > isObject (show) > _renderMainExample
|
|
534
|
+
// Priority: noMainExample (hide) > renderMediaSelector (show) > isObject (show) > isArray (show) > _renderMainExample
|
|
534
535
|
this._showExamples = !this.noMainExample && (
|
|
535
536
|
this.renderMediaSelector || // Need to show the section for the media type selector
|
|
536
537
|
isObject || // Objects can generate examples automatically
|
|
538
|
+
isArray || // Arrays can generate examples automatically
|
|
537
539
|
this._renderMainExample // Has explicit examples
|
|
538
540
|
);
|
|
539
541
|
|
|
540
|
-
// Effective media type - use 'application/json' as default for objects without mediaType
|
|
541
|
-
this._exampleMediaType = this.mediaType || (isObject ? 'application/json' : undefined);
|
|
542
|
+
// Effective media type - use 'application/json' as default for objects and arrays without mediaType
|
|
543
|
+
this._exampleMediaType = this.mediaType || (isObject || isArray ? 'application/json' : undefined);
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
/**
|
|
@@ -1141,7 +1143,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
1141
1143
|
: this._renderMainExample;
|
|
1142
1144
|
const exampleMediaType = this._exampleMediaType !== undefined
|
|
1143
1145
|
? this._exampleMediaType
|
|
1144
|
-
: (this.mediaType || (this.isObject ? 'application/json' : undefined));
|
|
1146
|
+
: (this.mediaType || (this.isObject || this.isArray ? 'application/json' : undefined));
|
|
1145
1147
|
|
|
1146
1148
|
return html`<style>${this.styles}</style>
|
|
1147
1149
|
${shouldRenderExamples ? html`<section class="examples">
|