File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export interface OpenAPI3 {
8
8
openapi : string ;
9
9
components : {
10
10
schemas : { [ key : string ] : OpenAPI3SchemaObject | OpenAPI3Reference } ;
11
+ responses ?: { [ key : string ] : OpenAPI3SchemaObject | OpenAPI3Reference } ;
11
12
} ;
12
13
[ key : string ] : any ; // handle other properties beyond swagger-to-ts’ concern
13
14
}
Original file line number Diff line number Diff line change @@ -126,10 +126,22 @@ export default function generateTypesV3(
126
126
return output ;
127
127
}
128
128
129
+ const schemas = `schemas: {
130
+ ${ createKeys ( propertyMapped , Object . keys ( propertyMapped ) ) }
131
+ }` ;
132
+
133
+ const responses = ! schema . components . responses
134
+ ? ``
135
+ : `responses: {
136
+ ${ createKeys (
137
+ schema . components . responses ,
138
+ Object . keys ( schema . components . responses )
139
+ ) }
140
+ }` ;
141
+
129
142
// note: make sure that base-level schemas are required
130
143
return `export interface components {
131
- schemas: {
132
- ${ createKeys ( propertyMapped , Object . keys ( propertyMapped ) ) }
133
- }
144
+ ${ schemas }
145
+ ${ responses }
134
146
}` ;
135
147
}
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ export interface components {
42
42
*/
43
43
status ?: "available" | "pending" | "sold" ;
44
44
} ;
45
+ } ;
46
+ responses : {
45
47
ApiResponse : { code ?: number ; type ?: string ; message ?: string } ;
46
48
} ;
47
49
}
Original file line number Diff line number Diff line change @@ -707,6 +707,7 @@ components:
707
707
- sold
708
708
xml :
709
709
name : Pet
710
+ responses :
710
711
ApiResponse :
711
712
type : object
712
713
properties :
You can’t perform that action at this time.
0 commit comments