Skip to content

Commit c1bba9b

Browse files
authored
Merge pull request #92 from wiz-kakiuchi/fix/ZodNativeEnum-to-openapi-type
For 'nativeEnum', should be 'type: integer', not 'type: number
2 parents 31939e8 + d48043e commit c1bba9b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spec/types/native-enum.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('native enum', () => {
4141

4242
expectSchema([nativeEnumSchema], {
4343
NativeEnum: {
44-
type: 'number',
44+
type: 'integer',
4545
description: 'A native numbers enum in zod',
4646
enum: [1, 42, 3],
4747
},

src/openapi-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ export class OpenAPIGenerator {
810810

811811
return {
812812
...this.mapNullableType(
813-
type === 'numeric' ? 'number' : 'string',
813+
type === 'numeric' ? 'integer' : 'string',
814814
isNullable
815815
),
816816
enum: values,

0 commit comments

Comments
 (0)