File tree 3 files changed +13
-10
lines changed
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ export const generateInterface = ({
46
46
scalar . type === 'object' &&
47
47
! context ?. output . override ?. useTypeOverInterfaces
48
48
) {
49
- model += `export interface ${ name } ${ scalar . value } \n` ;
49
+ // If `scalar.value` is 'unknown', replace it with `{}` to avoid type error
50
+ const blankInterfaceValue =
51
+ scalar . value === 'unknown' ? '{}' : scalar . value ;
52
+
53
+ model += `export interface ${ name } ${ blankInterfaceValue } \n` ;
50
54
} else {
51
55
model += `export type ${ name } = ${ scalar . value } ;\n` ;
52
56
}
Original file line number Diff line number Diff line change @@ -202,16 +202,10 @@ export const getObject = ({
202
202
} ;
203
203
}
204
204
205
- const useTypeOverInterfaces = context ?. output . override ?. useTypeOverInterfaces ;
206
- const blankValue =
207
- item . type === 'object'
208
- ? '{ [key: string]: any }'
209
- : useTypeOverInterfaces
210
- ? 'unknown'
211
- : '{}' ;
212
-
213
205
return {
214
- value : blankValue + nullable ,
206
+ value :
207
+ ( item . type === 'object' ? '{ [key: string]: any }' : 'unknown' ) +
208
+ nullable ,
215
209
imports : [ ] ,
216
210
schemas : [ ] ,
217
211
isEnum : false ,
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ components:
19
19
items :
20
20
type : string
21
21
nullable : true
22
+ BlankSchema : {}
23
+ NotDifinedType :
24
+ properties :
25
+ id :
26
+ description : not defined type schema
22
27
paths :
23
28
/endpointA :
24
29
get :
You can’t perform that action at this time.
0 commit comments