File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ export function generateTypeDefinitions(spec: OpenAPIV3.Document): string {
8989 [ ] ) as OpenAPIV3 . ParameterObject [ ] ;
9090 const queryParams = ( parameters ?. filter ( ( p ) => "in" in p && p . in === "query" ) ||
9191 [ ] ) as OpenAPIV3 . ParameterObject [ ] ;
92+ const headerParams = ( parameters ?. filter ( ( p ) => "in" in p && p . in === "header" ) ||
93+ [ ] ) as OpenAPIV3 . ParameterObject [ ] ;
9294
9395 // Add path and query parameters
9496 urlParams . forEach ( ( p ) => {
@@ -114,6 +116,19 @@ export function generateTypeDefinitions(spec: OpenAPIV3.Document): string {
114116 : "" ;
115117 dataProps . push ( `${ desc } ${ safeName } ${ p . required ? "" : "?" } : ${ getTypeFromSchema ( p . schema ) } ` ) ;
116118 } ) ;
119+
120+ headerParams . forEach ( ( p ) => {
121+ const safeName = sanitizePropertyName ( p . name ) ;
122+ const isDeprecated = "deprecated" in p && p . deprecated ;
123+ const hasDescription = "description" in p && p . description ;
124+ const desc =
125+ hasDescription || isDeprecated
126+ ? `\n/**${ hasDescription ? `\n* ${ p . description } ` : "" } ${ isDeprecated ? "\n* @deprecated" : "" }
127+ */\n`
128+ : "" ;
129+ dataProps . push ( `${ desc } ${ safeName } ${ p . required ? "" : "?" } : ${ getTypeFromSchema ( p . schema ) } ` ) ;
130+ } ) ;
131+
117132 // Add request body type if it exists
118133 const hasData = ( parameters && parameters . length > 0 ) || requestBody ;
119134
You can’t perform that action at this time.
0 commit comments