Skip to content

Commit

Permalink
fix(core): minor type corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
MathurAditya724 committed Jan 19, 2025
1 parent 529d5c5 commit 9cea732
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/core/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { OpenAPIV3 } from "openapi-types";
import type { OpenAPIRoute } from "./types.js";
import type { OpenAPIRoute, OpenApiSpecsOptions } from "./types.js";

export const ALLOWED_METHODS = [
"GET",
Expand Down Expand Up @@ -73,16 +73,14 @@ export function filterPaths(
{
excludeStaticFile = true,
exclude = [],
}: {
excludeStaticFile: boolean;
exclude: (string | RegExp)[];
},
}: Pick<OpenApiSpecsOptions, "excludeStaticFile" | "exclude">,
) {
const newPaths: OpenAPIV3.PathsObject = {};
const _exclude = Array.isArray(exclude) ? exclude : [exclude];

for (const [key, value] of Object.entries(paths)) {
if (
!exclude.some((x) => {
!_exclude.some((x) => {
if (typeof x === "string") return key === x;

return x.test(key);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export async function generateSpecs<
paths: {
...filterPaths(schema, {
excludeStaticFile,
exclude: Array.isArray(exclude) ? exclude : [exclude],
exclude,
}),
...documentation.paths,
},
Expand Down

0 comments on commit 9cea732

Please sign in to comment.