typed-openapi 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,7 +77,17 @@ var openApiSchemaToTs = ({ schema, meta: _inheritedMeta, ctx }) => {
77
77
  if (schema.enum) {
78
78
  if (schema.enum.length === 1) {
79
79
  const value = schema.enum[0];
80
- return t.literal(value === null ? "null" : value === true ? "true" : value === false ? "false" : `"${value}"`);
80
+ if (value === null) {
81
+ return t.literal("null");
82
+ } else if (value === true) {
83
+ return t.literal("true");
84
+ } else if (value === false) {
85
+ return t.literal("false");
86
+ } else if (typeof value === "number") {
87
+ return t.literal(`${value}`);
88
+ } else {
89
+ return t.literal(`"${value}"`);
90
+ }
81
91
  }
82
92
  if (schemaType === "string") {
83
93
  return t.union(schema.enum.map((value) => t.literal(`"${value}"`)));
@@ -4,7 +4,7 @@ import {
4
4
  generateTanstackQueryFile,
5
5
  mapOpenApiEndpoints,
6
6
  prettify
7
- } from "./chunk-FM2BOVDQ.js";
7
+ } from "./chunk-5UEEXUUO.js";
8
8
 
9
9
  // src/generate-client-files.ts
10
10
  import SwaggerParser from "@apidevtools/swagger-parser";
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  generateClientFiles
3
- } from "./chunk-4LBBEM6D.js";
3
+ } from "./chunk-UQGHH67X.js";
4
4
  import {
5
5
  allowedRuntimes
6
- } from "./chunk-FM2BOVDQ.js";
6
+ } from "./chunk-5UEEXUUO.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { cac } from "cac";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  openApiSchemaToTs,
9
9
  tsFactory,
10
10
  unwrap
11
- } from "./chunk-FM2BOVDQ.js";
11
+ } from "./chunk-5UEEXUUO.js";
12
12
  export {
13
13
  createBoxFactory,
14
14
  createFactory,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  generateClientFiles
3
- } from "./chunk-4LBBEM6D.js";
3
+ } from "./chunk-UQGHH67X.js";
4
4
  import {
5
5
  prettify
6
- } from "./chunk-FM2BOVDQ.js";
6
+ } from "./chunk-5UEEXUUO.js";
7
7
  export {
8
8
  generateClientFiles,
9
9
  prettify
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typed-openapi",
3
3
  "type": "module",
4
- "version": "1.4.2",
4
+ "version": "1.4.3",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {
@@ -65,7 +65,17 @@ export const openApiSchemaToTs = ({ schema, meta: _inheritedMeta, ctx }: Openapi
65
65
  if (schema.enum) {
66
66
  if (schema.enum.length === 1) {
67
67
  const value = schema.enum[0];
68
- return t.literal(value === null ? "null" : value === true ? "true" : value === false ? "false" : `"${value}"`);
68
+ if (value === null) {
69
+ return t.literal("null");
70
+ } else if (value === true) {
71
+ return t.literal("true");
72
+ } else if (value === false) {
73
+ return t.literal("false");
74
+ } else if (typeof value === "number") {
75
+ return t.literal(`${value}`)
76
+ } else {
77
+ return t.literal(`"${value}"`);
78
+ }
69
79
  }
70
80
 
71
81
  if (schemaType === "string") {