@@ -560,8 +560,26 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
560560 if ( Array . isArray ( item ) ) {
561561 return item ;
562562 }
563- const key = this . _getAmfKey ( this . ns . w3 . shacl . property ) ;
564- return this . _filterReadOnlyProperties ( this . _ensureArray ( item [ key ] ) ) ;
563+
564+ const propertyKey = this . _getAmfKey ( this . ns . w3 . shacl . property ) ;
565+ const itemProperties = this . _ensureArray ( item [ propertyKey ] )
566+ const additionalPropertiesKey = this . _getAmfKey ( this . ns . w3 . shacl . additionalPropertiesSchema ) ;
567+
568+ // If the item doesn't have additional properties, filter the read-only properties and return
569+ if ( ! item [ additionalPropertiesKey ] ) {
570+ return this . _filterReadOnlyProperties ( itemProperties )
571+ }
572+
573+ const additionalPropertiesSchema = this . _ensureArray ( item [ additionalPropertiesKey ] )
574+
575+ // If the item does have additional properties, ensure they are in an array
576+ const additionalProperties = this . _ensureArray ( additionalPropertiesSchema [ 0 ] [ propertyKey ] )
577+
578+ // Combine the item's properties and additional properties
579+ const combinedProperties = [ ...itemProperties , ...additionalProperties ]
580+
581+ // Filter the read-only properties and return
582+ return this . _filterReadOnlyProperties ( combinedProperties ) ;
565583 }
566584
567585 /**
@@ -702,7 +720,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
702720 /**
703721 * @return {TemplateResult } Templates for object properties
704722 */
705- _arrayTemplate ( ) {
723+ _arrayTemplate ( ) {
706724 const items = this . _computeArrayProperties ( this . _resolvedType ) || [ ] ;
707725 const documents = items . map (
708726 ( item ) => html `
@@ -742,9 +760,9 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
742760 < span > Array of:</ span >
743761 < div class ="array-children ">
744762 ${ documents }
745- </ div > `
763+ </ div > `
746764 : html `${ documents } `
747- }
765+ }
748766
749767 ${ this . _arrayPropertiesTemplate ( ) }
750768 ` ;
@@ -758,7 +776,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
758776 const selected = this . selectedUnion ;
759777 const selectTypeCallback = this . _selectType . bind ( this , 'selectedUnion' ) ;
760778 const key = this . _getAmfKey ( this . ns . aml . vocabularies . shapes . anyOf ) ;
761- const type = this . _computeProperty ( this . _resolvedType , key , selected ) ;
779+ const type = this . _computeProperty ( this . _resolvedType , key , selected ) ;
762780 const typeName = 'union'
763781 const label = 'Any of'
764782 return this . _multiTypeTemplate ( { label, items, typeName, selected, selectTypeCallback, type } ) ;
@@ -855,10 +873,10 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
855873 }
856874 return html ` ${ items . map (
857875 ( item ) => html ` ${ item . label
858- ? html `< p class ="inheritance-label ">
876+ ? html `< p class ="inheritance-label ">
859877 Properties inherited from < b > ${ item . label } </ b > .
860878 </ p > `
861- : html `< p class ="inheritance-label "> Properties defined inline.</ p > ` }
879+ : html `< p class ="inheritance-label "> Properties defined inline.</ p > ` }
862880 < api-type-document
863881 class ="and-document "
864882 .amf ="${ this . amf } "
@@ -887,12 +905,12 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
887905 return html `< style > ${ this . styles } </ style >
888906 < section class ="examples " ?hidden ="${ ! this . _renderMainExample } ">
889907 ${ this . shouldRenderMediaSelector
890- ? html `< div class ="media-type-selector ">
908+ ? html `< div class ="media-type-selector ">
891909 < span > Media type:</ span >
892910 ${ mediaTypes . map ( ( item , index ) => {
893- const selected = this . selectedMediaType === index ;
894- const pressed = selected ? 'true' : 'false' ;
895- return html `< anypoint-button
911+ const selected = this . selectedMediaType === index ;
912+ const pressed = selected ? 'true' : 'false' ;
913+ return html `< anypoint-button
896914 part ="content-action-button "
897915 class ="media-toggle "
898916 data-index ="${ index } "
@@ -903,9 +921,9 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
903921 title ="Select ${ item } media type "
904922 > ${ item } </ anypoint-button
905923 > ` ;
906- } ) }
924+ } ) }
907925 </ div > `
908- : '' }
926+ : '' }
909927
910928 < api-resource-example-document
911929 .amf ="${ this . amf } "
0 commit comments