@@ -98,7 +98,7 @@ function CRD() {
9898}
9999
100100function SchemaPart ( { key, property, parent, parentSlug } ) {
101- const [ props , propKeys , required , type , schema ] = useMemo ( ( ) => {
101+ const [ props , propKeys , required , type , schema , enumvals ] = useMemo ( ( ) => {
102102 let schema = property ;
103103 let props = property . Properties || { } ;
104104
@@ -113,13 +113,18 @@ function SchemaPart({ key, property, parent, parentSlug }) {
113113 type = `[]object` ;
114114 }
115115 }
116+ if ( property . Enum ) {
117+ type = `${ type } : enum` ;
118+ }
119+ let enumvals = property . Enum ?? [ ] ;
120+
116121 let propKeys = Object . keys ( props ) ;
117122
118123 let required = false ;
119124 if ( parent && parent . Required && parent . Required . includes ( key ) ) {
120125 required = true ;
121126 }
122- return [ props , propKeys , required , type , schema ]
127+ return [ props , propKeys , required , type , schema , enumvals ]
123128 } , [ parent , property ] ) ;
124129
125130 const slug = useMemo ( ( ) => slugify ( ( parentSlug ? `${ parentSlug } -` : '' ) + key ) , [ parentSlug , key ] ) ;
@@ -156,10 +161,13 @@ function SchemaPart({ key, property, parent, parentSlug }) {
156161 return html `
157162 < details class ="collapse-panel " open ="${ isOpen } " onToggle =${ e => { setIsOpen ( e . target . open ) ; e . stopPropagation ( ) ; } } >
158163 < summary class ="collapse-header position-relative ">
159- ${ key } < kbd class ="text-muted "> ${ type } </ kbd > ${ required ? html `< span class ="badge badge-primary "> required</ span > ` : '' }
164+ ${ key } < span class ="badge text-muted "> < code > ${ type } </ code > </ span > ${ required ? html `< span class ="badge badge-primary "> required</ span > ` : '' }
160165 < button class ="btn btn-sm position-absolute right-0 top-0 m-5 copy-url z-10 " type ="button " data-clipboard-text ="${ fullLink } "> 🔗</ button >
161166 </ summary >
162167 < div id ="${ slug } " class ="collapse-content ">
168+ ${ enumvals . length > 0 ? html `< div class ="property-description mb-10 ">
169+ Enum variants: ${ enumvals . map ( v => html `< span class ="badge text-muted mr-5 mb-5 "> < code > ${ v } </ code > </ span > ` ) }
170+ </ div > ` : '' }
163171 ${ React . createElement ( "div" , { className : 'property-description' , dangerouslySetInnerHTML : { __html : getDescription ( property ) } } ) }
164172 ${ propKeys . length > 0 ? html `< br /> ` : '' }
165173 < div class ="collapse-group ">
0 commit comments