Skip to content

Commit a9ffefe

Browse files
authored
fix: duplicate array decoration (#32)
1 parent 227e582 commit a9ffefe

File tree

1 file changed

+41
-50
lines changed

1 file changed

+41
-50
lines changed

src/ApiTypeDocument.js

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -655,57 +655,48 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
655655
/**
656656
* @return {TemplateResult} Templates for object properties
657657
*/
658-
_arrayTemplate() {
658+
_arrayTemplate() {
659659
const items = this._computeArrayProperties(this._resolvedType) || [];
660-
return html`
661-
${this.hasParentType
662-
? html`<property-shape-document
663-
class="array-document"
664-
.amf="${this.amf}"
665-
.shape="${this._resolvedType}"
666-
.parentTypeName="${this.parentTypeName}"
667-
?narrow="${this.narrow}"
668-
?noExamplesActions="${this.noExamplesActions}"
669-
?compatibility="${this.compatibility}"
670-
.mediaType="${this.mediaType}"
671-
?graph="${this.graph}"
672-
></property-shape-document>`
673-
: html`<span>Array of:</span>`}
674-
675-
<div class="array-children">
676-
${items.map(
677-
(item) => html`
678-
${item.isShape
679-
? html`<property-shape-document
680-
class="array-document"
681-
.amf="${this.amf}"
682-
.shape="${item}"
683-
parentTypeName="${this._computeArrayParentName(this.parentTypeName)}"
684-
?narrow="${this.narrow}"
685-
?noExamplesActions="${this.noExamplesActions}"
686-
?compatibility="${this.compatibility}"
687-
.mediaType="${this.mediaType}"
688-
?graph="${this.graph}"
689-
></property-shape-document>`
690-
: ''}
691-
${item.isType
692-
? html`<api-type-document
693-
class="union-document"
694-
.amf="${this.amf}"
695-
.parentTypeName="${this.parentTypeName}"
696-
.type="${item}"
697-
?narrow="${this.narrow}"
698-
?noExamplesActions="${this.noExamplesActions}"
699-
?noMainExample="${this._renderMainExample}"
700-
?compatibility="${this.compatibility}"
701-
.mediaType="${this.mediaType}"
702-
?graph="${this.graph}"
703-
></api-type-document>`
704-
: ''}
705-
`
706-
)}
707-
</div>
708-
`;
660+
const documents = items.map(
661+
(item) => html`
662+
${item.isShape
663+
? html`<property-shape-document
664+
class="array-document"
665+
.amf="${this.amf}"
666+
.shape="${item}"
667+
parentTypeName="${this._computeArrayParentName(this.parentTypeName)}"
668+
?narrow="${this.narrow}"
669+
?noExamplesActions="${this.noExamplesActions}"
670+
?compatibility="${this.compatibility}"
671+
.mediaType="${this.mediaType}"
672+
?graph="${this.graph}"
673+
></property-shape-document>`
674+
: ''}
675+
${item.isType
676+
? html`<api-type-document
677+
class="union-document"
678+
.amf="${this.amf}"
679+
.parentTypeName="${this.parentTypeName}"
680+
.type="${item}"
681+
?narrow="${this.narrow}"
682+
?noExamplesActions="${this.noExamplesActions}"
683+
?noMainExample="${this._renderMainExample}"
684+
?compatibility="${this.compatibility}"
685+
.mediaType="${this.mediaType}"
686+
?graph="${this.graph}"
687+
></api-type-document>`
688+
: ''}
689+
`
690+
);
691+
if (!this.hasParentType) {
692+
return html`
693+
<span>Array of:</span>
694+
<div class="array-children">
695+
${documents}
696+
</div>
697+
`;
698+
}
699+
return html`${documents}`;
709700
}
710701

711702
/**

0 commit comments

Comments
 (0)