@@ -95,10 +95,7 @@ export const getModel = (
95
95
}
96
96
}
97
97
98
- if (
99
- definition . type === 'object' &&
100
- ( typeof definition . additionalProperties === 'object' || definition . additionalProperties === true )
101
- ) {
98
+ if ( typeof definition . additionalProperties === 'object' || definition . additionalProperties === true ) {
102
99
const ap = typeof definition . additionalProperties === 'object' ? definition . additionalProperties : { } ;
103
100
if ( ap . $ref ) {
104
101
const additionalProperties = getType ( ap . $ref ) ;
@@ -149,34 +146,32 @@ export const getModel = (
149
146
return model ;
150
147
}
151
148
152
- if ( definition . type === 'object' ) {
153
- if ( definition . properties ) {
154
- model . export = 'interface' ;
155
- model . type = 'any' ;
156
- model . base = 'any' ;
157
- model . default = getModelDefault ( definition , model ) ;
149
+ if ( definition . properties ) {
150
+ model . export = 'interface' ;
151
+ model . type = 'any' ;
152
+ model . base = 'any' ;
153
+ model . default = getModelDefault ( definition , model ) ;
158
154
159
- const modelProperties = getModelProperties ( openApi , definition , getModel , model ) ;
160
- modelProperties . forEach ( modelProperty => {
161
- model . imports . push ( ...modelProperty . imports ) ;
162
- model . enums . push ( ...modelProperty . enums ) ;
163
- model . properties . push ( modelProperty ) ;
164
- if ( modelProperty . export === 'enum' ) {
165
- model . enums . push ( modelProperty ) ;
166
- }
167
- } ) ;
168
- return model ;
169
- } else {
170
- const additionalProperties = getModel ( openApi , { } ) ;
171
- model . export = 'dictionary' ;
172
- model . type = additionalProperties . type ;
173
- model . base = additionalProperties . base ;
174
- model . template = additionalProperties . template ;
175
- model . link = additionalProperties ;
176
- model . imports . push ( ...additionalProperties . imports ) ;
177
- model . default = getModelDefault ( definition , model ) ;
178
- return model ;
179
- }
155
+ const modelProperties = getModelProperties ( openApi , definition , getModel , model ) ;
156
+ modelProperties . forEach ( modelProperty => {
157
+ model . imports . push ( ...modelProperty . imports ) ;
158
+ model . enums . push ( ...modelProperty . enums ) ;
159
+ model . properties . push ( modelProperty ) ;
160
+ if ( modelProperty . export === 'enum' ) {
161
+ model . enums . push ( modelProperty ) ;
162
+ }
163
+ } ) ;
164
+ return model ;
165
+ } else if ( definition . type === 'object' ) {
166
+ const additionalProperties = getModel ( openApi , { } ) ;
167
+ model . export = 'dictionary' ;
168
+ model . type = additionalProperties . type ;
169
+ model . base = additionalProperties . base ;
170
+ model . template = additionalProperties . template ;
171
+ model . link = additionalProperties ;
172
+ model . imports . push ( ...additionalProperties . imports ) ;
173
+ model . default = getModelDefault ( definition , model ) ;
174
+ return model ;
180
175
}
181
176
182
177
// If the schema has a type than it can be a basic or generic type.
0 commit comments