@omer-x/next-openapi-json-generator 1.3.2 → 1.3.4

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.
package/dist/index.cjs CHANGED
@@ -276,8 +276,11 @@ var import_zod_to_json_schema = require("zod-to-json-schema");
276
276
 
277
277
  // src/utils/zod-schema.ts
278
278
  function isFile(schema) {
279
- const result = schema.safeParse(new File([], "nothing.txt"));
280
- return result.success;
279
+ const file = new File([], "nothing.txt");
280
+ const plainObject = { name: "test", size: 0 };
281
+ const fileResult = schema.safeParse(file);
282
+ const objectResult = schema.safeParse(plainObject);
283
+ return fileResult.success && !objectResult.success;
281
284
  }
282
285
 
283
286
  // src/core/zod-to-openapi.ts
@@ -431,6 +434,7 @@ async function generateOpenApiSpec(schemas, {
431
434
  exclude: excludeOption = [],
432
435
  routeDefinerName = "defineRoute",
433
436
  rootPath: additionalRootPath,
437
+ info,
434
438
  servers,
435
439
  security,
436
440
  securitySchemes,
@@ -469,7 +473,8 @@ async function generateOpenApiSpec(schemas, {
469
473
  openapi: "3.1.0",
470
474
  info: {
471
475
  title: metadata.serviceName,
472
- version: metadata.version
476
+ version: metadata.version,
477
+ ...info ?? {}
473
478
  },
474
479
  servers,
475
480
  ...clearUnusedSchemasOption ? clearUnusedSchemas(pathsAndComponents) : pathsAndComponents,
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { OpenApiDocument } from '@omer-x/openapi-types';
2
2
  import { ComponentsObject } from '@omer-x/openapi-types/components';
3
- import { ServerObject } from '@omer-x/openapi-types/server';
4
3
  import { ZodType } from 'zod';
5
4
 
6
5
  type GeneratorOptions = {
@@ -8,11 +7,12 @@ type GeneratorOptions = {
8
7
  exclude?: string[];
9
8
  routeDefinerName?: string;
10
9
  rootPath?: string;
11
- servers?: ServerObject[];
10
+ info?: OpenApiDocument["info"];
11
+ servers?: OpenApiDocument["servers"];
12
12
  security?: OpenApiDocument["security"];
13
13
  securitySchemes?: ComponentsObject["securitySchemes"];
14
14
  clearUnusedSchemas?: boolean;
15
15
  };
16
- declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, servers, security, securitySchemes, clearUnusedSchemas: clearUnusedSchemasOption, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
16
+ declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, info, servers, security, securitySchemes, clearUnusedSchemas: clearUnusedSchemasOption, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
17
17
 
18
18
  export { generateOpenApiSpec as default };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { OpenApiDocument } from '@omer-x/openapi-types';
2
2
  import { ComponentsObject } from '@omer-x/openapi-types/components';
3
- import { ServerObject } from '@omer-x/openapi-types/server';
4
3
  import { ZodType } from 'zod';
5
4
 
6
5
  type GeneratorOptions = {
@@ -8,11 +7,12 @@ type GeneratorOptions = {
8
7
  exclude?: string[];
9
8
  routeDefinerName?: string;
10
9
  rootPath?: string;
11
- servers?: ServerObject[];
10
+ info?: OpenApiDocument["info"];
11
+ servers?: OpenApiDocument["servers"];
12
12
  security?: OpenApiDocument["security"];
13
13
  securitySchemes?: ComponentsObject["securitySchemes"];
14
14
  clearUnusedSchemas?: boolean;
15
15
  };
16
- declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, servers, security, securitySchemes, clearUnusedSchemas: clearUnusedSchemasOption, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
16
+ declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, info, servers, security, securitySchemes, clearUnusedSchemas: clearUnusedSchemasOption, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
17
17
 
18
18
  export { generateOpenApiSpec as default };
package/dist/index.js CHANGED
@@ -240,8 +240,11 @@ import { zodToJsonSchema } from "zod-to-json-schema";
240
240
 
241
241
  // src/utils/zod-schema.ts
242
242
  function isFile(schema) {
243
- const result = schema.safeParse(new File([], "nothing.txt"));
244
- return result.success;
243
+ const file = new File([], "nothing.txt");
244
+ const plainObject = { name: "test", size: 0 };
245
+ const fileResult = schema.safeParse(file);
246
+ const objectResult = schema.safeParse(plainObject);
247
+ return fileResult.success && !objectResult.success;
245
248
  }
246
249
 
247
250
  // src/core/zod-to-openapi.ts
@@ -395,6 +398,7 @@ async function generateOpenApiSpec(schemas, {
395
398
  exclude: excludeOption = [],
396
399
  routeDefinerName = "defineRoute",
397
400
  rootPath: additionalRootPath,
401
+ info,
398
402
  servers,
399
403
  security,
400
404
  securitySchemes,
@@ -433,7 +437,8 @@ async function generateOpenApiSpec(schemas, {
433
437
  openapi: "3.1.0",
434
438
  info: {
435
439
  title: metadata.serviceName,
436
- version: metadata.version
440
+ version: metadata.version,
441
+ ...info ?? {}
437
442
  },
438
443
  servers,
439
444
  ...clearUnusedSchemasOption ? clearUnusedSchemas(pathsAndComponents) : pathsAndComponents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/next-openapi-json-generator",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "a Next.js plugin to generate OpenAPI documentation from route handlers",
5
5
  "keywords": [
6
6
  "next.js",
@@ -47,18 +47,18 @@
47
47
  "dependencies": {
48
48
  "@omer-x/package-metadata": "^1.0.2",
49
49
  "minimatch": "^10.0.1",
50
- "typescript": "^5.6.3",
51
- "zod-to-json-schema": "^3.23.5"
50
+ "typescript": "^5.7.2",
51
+ "zod-to-json-schema": "^3.24.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@omer-x/eslint-config": "^2.0.2",
55
- "@types/node": "^22.9.0",
56
- "eslint": "^9.14.0",
54
+ "@omer-x/eslint-config": "^2.1.2",
55
+ "@types/node": "^22.10.2",
56
+ "eslint": "^9.16.0",
57
57
  "semantic-release": "^24.2.0",
58
58
  "ts-jest": "^29.2.5",
59
59
  "ts-node": "^10.9.2",
60
60
  "tsup": "^8.3.5",
61
- "zod": "^3.23.8"
61
+ "zod": "^3.24.1"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@omer-x/next-openapi-route-handler": "^1",