File tree 1 file changed +22
-0
lines changed 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,24 @@ export function expandGenerics (inputModel: Model): Model {
134
134
}
135
135
}
136
136
137
+ /**
138
+ * Add dangling types like CommonQueryParameters & BaseEsqlVersion to the generic less schema.
139
+ * @param type the type definition
140
+ */
141
+ function addDanglingTypeIfNotSeen ( type : TypeDefinition ) {
142
+ switch ( type . kind ) {
143
+ case "type_alias" :
144
+ if ( type . generics !== undefined && type . generics . length > 0 ) {
145
+ return ;
146
+ }
147
+ case "interface" :
148
+ if ( type . generics !== undefined && type . generics . length > 0 ) {
149
+ return ;
150
+ }
151
+ }
152
+ addIfNotSeen ( type . name , ( ) => type )
153
+ }
154
+
137
155
/**
138
156
* Expand an interface definition.
139
157
*
@@ -361,6 +379,10 @@ export function expandGenerics (inputModel: Model): Model {
361
379
expandRootType ( endpoint . response )
362
380
}
363
381
382
+ for ( const type of inputModel . types ) {
383
+ addDanglingTypeIfNotSeen ( type ) ;
384
+ }
385
+
364
386
sortTypeDefinitions ( types )
365
387
366
388
return {
You can’t perform that action at this time.
0 commit comments