@@ -59,7 +59,7 @@ export const SamSchemaTransformer = {
5959 typeName : resourceType ,
6060 description : SAM_RESOURCE_DESCRIPTIONS . get ( resourceType ) ?? `${ resourceType } resource` ,
6161 documentationUrl : SAM_DOCUMENTATION_URLS . get ( resourceType ) ?? '' ,
62- properties : ( propertiesSchema ?. properties as Record < string , unknown > ) ?? { } ,
62+ properties : this . resolvePropertyTypes ( propertiesSchema ?. properties as Record < string , unknown > ?? { } , samSchema . definitions ) ,
6363 definitions : samSchema . definitions ,
6464 additionalProperties : false ,
6565 required : ( propertiesSchema ?. required as string [ ] ) ?? [ ] ,
@@ -75,4 +75,47 @@ export const SamSchemaTransformer = {
7575
7676 return resourceSchemas ;
7777 } ,
78+
79+ resolvePropertyTypes ( properties : Record < string , unknown > , definitions : Record < string , unknown > ) : Record < string , unknown > {
80+ const resolved : Record < string , unknown > = { } ;
81+
82+ for ( const [ key , value ] of Object . entries ( properties ) ) {
83+ resolved [ key ] = this . resolveProperty ( value as Record < string , unknown > , definitions ) ;
84+ }
85+
86+ return resolved ;
87+ } ,
88+
89+ resolveProperty ( property : Record < string , unknown > , definitions : Record < string , unknown > ) : Record < string , unknown > {
90+ // Convert markdownDescription to description for hover formatter
91+ if ( property . markdownDescription && ! property . description ) {
92+ property = { ...property , description : property . markdownDescription } ;
93+ }
94+
95+ // If property already has a type, keep it
96+ if ( property . type ) {
97+ return property ;
98+ }
99+
100+ // Handle allOf patterns
101+ if ( property . allOf && Array . isArray ( property . allOf ) ) {
102+ const allOfItem = property . allOf [ 0 ] as Record < string , unknown > ;
103+ if ( allOfItem ?. $ref ) {
104+ const resolved = this . resolveProperty ( allOfItem , definitions ) ;
105+ return { ...resolved , ...property , allOf : undefined } ;
106+ }
107+ }
108+
109+ // Handle $ref
110+ if ( property . $ref ) {
111+ const refKey = ( property . $ref as string ) . replace ( '#/definitions/' , '' ) ;
112+ const refDef = definitions [ refKey ] as Record < string , unknown > ;
113+ if ( refDef ) {
114+ const resolved = this . resolveProperty ( refDef , definitions ) ;
115+ return { ...resolved , ...property , $ref : undefined } ;
116+ }
117+ }
118+
119+ return property ;
120+ } ,
78121} ;
0 commit comments