@@ -560,8 +560,26 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
560
560
if ( Array . isArray ( item ) ) {
561
561
return item ;
562
562
}
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 ) ;
565
583
}
566
584
567
585
/**
@@ -702,7 +720,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
702
720
/**
703
721
* @return {TemplateResult } Templates for object properties
704
722
*/
705
- _arrayTemplate ( ) {
723
+ _arrayTemplate ( ) {
706
724
const items = this . _computeArrayProperties ( this . _resolvedType ) || [ ] ;
707
725
const documents = items . map (
708
726
( item ) => html `
@@ -742,9 +760,9 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
742
760
< span > Array of:</ span >
743
761
< div class ="array-children ">
744
762
${ documents }
745
- </ div > `
763
+ </ div > `
746
764
: html `${ documents } `
747
- }
765
+ }
748
766
749
767
${ this . _arrayPropertiesTemplate ( ) }
750
768
` ;
@@ -758,7 +776,7 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
758
776
const selected = this . selectedUnion ;
759
777
const selectTypeCallback = this . _selectType . bind ( this , 'selectedUnion' ) ;
760
778
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 ) ;
762
780
const typeName = 'union'
763
781
const label = 'Any of'
764
782
return this . _multiTypeTemplate ( { label, items, typeName, selected, selectTypeCallback, type } ) ;
@@ -855,10 +873,10 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
855
873
}
856
874
return html ` ${ items . map (
857
875
( item ) => html ` ${ item . label
858
- ? html `< p class ="inheritance-label ">
876
+ ? html `< p class ="inheritance-label ">
859
877
Properties inherited from < b > ${ item . label } </ b > .
860
878
</ p > `
861
- : html `< p class ="inheritance-label "> Properties defined inline.</ p > ` }
879
+ : html `< p class ="inheritance-label "> Properties defined inline.</ p > ` }
862
880
< api-type-document
863
881
class ="and-document "
864
882
.amf ="${ this . amf } "
@@ -887,12 +905,12 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
887
905
return html `< style > ${ this . styles } </ style >
888
906
< section class ="examples " ?hidden ="${ ! this . _renderMainExample } ">
889
907
${ this . shouldRenderMediaSelector
890
- ? html `< div class ="media-type-selector ">
908
+ ? html `< div class ="media-type-selector ">
891
909
< span > Media type:</ span >
892
910
${ 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
896
914
part ="content-action-button "
897
915
class ="media-toggle "
898
916
data-index ="${ index } "
@@ -903,9 +921,9 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
903
921
title ="Select ${ item } media type "
904
922
> ${ item } </ anypoint-button
905
923
> ` ;
906
- } ) }
924
+ } ) }
907
925
</ div > `
908
- : '' }
926
+ : '' }
909
927
910
928
< api-resource-example-document
911
929
.amf ="${ this . amf } "
0 commit comments