@omer-x/next-openapi-json-generator 1.2.2 → 1.3.0

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
@@ -429,7 +429,8 @@ async function generateOpenApiSpec(schemas, {
429
429
  rootPath: additionalRootPath,
430
430
  servers,
431
431
  security,
432
- securitySchemes
432
+ securitySchemes,
433
+ clearUnusedSchemas: clearUnusedSchemasOption = true
433
434
  } = {}) {
434
435
  const verifiedOptions = verifyOptions(includeOption, excludeOption);
435
436
  const appFolderPath = await findAppFolderPath();
@@ -467,7 +468,7 @@ async function generateOpenApiSpec(schemas, {
467
468
  version: metadata.version
468
469
  },
469
470
  servers,
470
- ...clearUnusedSchemas(pathsAndComponents),
471
+ ...clearUnusedSchemasOption ? clearUnusedSchemas(pathsAndComponents) : pathsAndComponents,
471
472
  security,
472
473
  tags: []
473
474
  };
package/dist/index.d.cts CHANGED
@@ -11,7 +11,8 @@ type GeneratorOptions = {
11
11
  servers?: ServerObject[];
12
12
  security?: OpenApiDocument["security"];
13
13
  securitySchemes?: ComponentsObject["securitySchemes"];
14
+ clearUnusedSchemas?: boolean;
14
15
  };
15
- declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, servers, security, securitySchemes, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
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
17
 
17
18
  export { generateOpenApiSpec as default };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,8 @@ type GeneratorOptions = {
11
11
  servers?: ServerObject[];
12
12
  security?: OpenApiDocument["security"];
13
13
  securitySchemes?: ComponentsObject["securitySchemes"];
14
+ clearUnusedSchemas?: boolean;
14
15
  };
15
- declare function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, rootPath: additionalRootPath, servers, security, securitySchemes, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
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
17
 
17
18
  export { generateOpenApiSpec as default };
package/dist/index.js CHANGED
@@ -393,7 +393,8 @@ async function generateOpenApiSpec(schemas, {
393
393
  rootPath: additionalRootPath,
394
394
  servers,
395
395
  security,
396
- securitySchemes
396
+ securitySchemes,
397
+ clearUnusedSchemas: clearUnusedSchemasOption = true
397
398
  } = {}) {
398
399
  const verifiedOptions = verifyOptions(includeOption, excludeOption);
399
400
  const appFolderPath = await findAppFolderPath();
@@ -431,7 +432,7 @@ async function generateOpenApiSpec(schemas, {
431
432
  version: metadata.version
432
433
  },
433
434
  servers,
434
- ...clearUnusedSchemas(pathsAndComponents),
435
+ ...clearUnusedSchemasOption ? clearUnusedSchemas(pathsAndComponents) : pathsAndComponents,
435
436
  security,
436
437
  tags: []
437
438
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/next-openapi-json-generator",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "a Next.js plugin to generate OpenAPI documentation from route handlers",
5
5
  "keywords": [
6
6
  "next.js",