File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
packages/openapi-typescript/src/transform Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -271,13 +271,13 @@ export function transformSchemaObjectWithComposition(
271271 * Check if the given OAPI enum should be transformed to a TypeScript enum
272272 */
273273function shouldTransformToTsEnum ( options : TransformNodeOptions , schemaObject : SchemaObject ) : boolean {
274- // Enum conversion not enabled
275- if ( ! options . ctx . enum ) {
274+ // Enum conversion not enabled or no enum present
275+ if ( ! options . ctx . enum || ! schemaObject . enum ) {
276276 return false ;
277277 }
278278
279279 // Enum must have string, number or null values
280- if ( ! schemaObject . enum ? .every ( ( v ) => typeof v === " string" || typeof v === "number" || v === null ) ) {
280+ if ( ! schemaObject . enum . every ( ( v ) => [ ' string' , 'number' , null ] . includes ( typeof v ) ) ) {
281281 return false ;
282282 }
283283
You can’t perform that action at this time.
0 commit comments