File tree Expand file tree Collapse file tree 4 files changed +12
-15
lines changed Expand file tree Collapse file tree 4 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -294,10 +294,6 @@ class CodeGenConfig {
294
294
"relative-json-pointer" : ( ) => this . Ts . Keyword . String ,
295
295
regex : ( ) => this . Ts . Keyword . String ,
296
296
} ,
297
- array : ( { items, ...schemaPart } , parser ) => {
298
- const content = parser . getInlineParseContent ( items ) ;
299
- return parser . schemaUtils . safeAddNullToType ( schemaPart , this . Ts . ArrayType ( content ) ) ;
300
- } ,
301
297
} ;
302
298
303
299
templateInfos = [
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class ComplexSchemaParser extends MonoSchemaParser {
22
22
this . config . Ts . IntersectionType (
23
23
_ . compact ( [
24
24
this . config . Ts . ExpressionGroup ( complexSchemaContent ) ,
25
- this . schemaParser . getInternalSchemaType ( simpleSchema ) === SCHEMA_TYPES . OBJECT &&
25
+ this . schemaUtils . getInternalSchemaType ( simpleSchema ) === SCHEMA_TYPES . OBJECT &&
26
26
this . config . Ts . ExpressionGroup ( this . schemaParser . getInlineParseContent ( simpleSchema ) ) ,
27
27
] ) ,
28
28
) || this . config . Ts . Keyword . Any ,
Original file line number Diff line number Diff line change @@ -99,15 +99,6 @@ class SchemaParser {
99
99
} ,
100
100
} ;
101
101
102
- getInternalSchemaType = ( schema ) => {
103
- if ( ! _ . isEmpty ( schema . enum ) || ! _ . isEmpty ( this . schemaUtils . getEnumNames ( schema ) ) ) return SCHEMA_TYPES . ENUM ;
104
- if ( schema . discriminator ) return SCHEMA_TYPES . DISCRIMINATOR ;
105
- if ( schema . allOf || schema . oneOf || schema . anyOf || schema . not ) return SCHEMA_TYPES . COMPLEX ;
106
- if ( ! _ . isEmpty ( schema . properties ) ) return SCHEMA_TYPES . OBJECT ;
107
-
108
- return SCHEMA_TYPES . PRIMITIVE ;
109
- } ;
110
-
111
102
/**
112
103
*
113
104
* @param schema {any}
@@ -133,7 +124,7 @@ class SchemaParser {
133
124
if ( schema . items && ! Array . isArray ( schema . items ) && ! schema . type ) {
134
125
schema . type = SCHEMA_TYPES . ARRAY ;
135
126
}
136
- schemaType = this . getInternalSchemaType ( schema ) ;
127
+ schemaType = this . schemaUtils . getInternalSchemaType ( schema ) ;
137
128
138
129
this . schemaPath . push ( ...( schemaPath || [ ] ) ) ;
139
130
this . schemaPath . push ( typeName ) ;
Original file line number Diff line number Diff line change @@ -174,6 +174,16 @@ class SchemaUtils {
174
174
return SCHEMA_TYPES . COMPLEX_UNKNOWN ;
175
175
} ;
176
176
177
+ getInternalSchemaType = ( schema ) => {
178
+ if ( ! _ . isEmpty ( schema . enum ) || ! _ . isEmpty ( this . getEnumNames ( schema ) ) ) return SCHEMA_TYPES . ENUM ;
179
+ if ( schema . discriminator ) return SCHEMA_TYPES . DISCRIMINATOR ;
180
+ if ( schema . allOf || schema . oneOf || schema . anyOf || schema . not ) return SCHEMA_TYPES . COMPLEX ;
181
+ if ( ! _ . isEmpty ( schema . properties ) ) return SCHEMA_TYPES . OBJECT ;
182
+ if ( schema . type === SCHEMA_TYPES . ARRAY ) return SCHEMA_TYPES . ARRAY ;
183
+
184
+ return SCHEMA_TYPES . PRIMITIVE ;
185
+ } ;
186
+
177
187
getSchemaType = ( schema ) => {
178
188
if ( ! schema ) return this . config . Ts . Keyword . Any ;
179
189
You can’t perform that action at this time.
0 commit comments