Skip to content

Commit

Permalink
Openapi generator should distinguish between integer and float numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Feb 13, 2024
1 parent d399a86 commit ad1842d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/nextlove/src/generators/lib/zod-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ function parseNumber({
}: ParsingArgs<z.ZodNumber>): SchemaObject {
const baseSchema: SchemaObject = {
type: "number",
format: "float",
}
const { checks = [] } = zodRef._def
checks.forEach((item) => {
Expand All @@ -206,6 +207,7 @@ function parseNumber({
break
case "int":
baseSchema.type = "integer"
delete baseSchema.format
break
case "multipleOf":
baseSchema.multipleOf = item.value
Expand Down

0 comments on commit ad1842d

Please sign in to comment.