Skip to content

Commit 513a0ef

Browse files
committed
feat: servers option
1 parent 1a70766 commit 513a0ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/core/generateOpenApiSpec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ import { verifyOptions } from "./options";
88
import { type RouteRecord, bundlePaths, createRouteRecord } from "./route";
99
import { bundleSchemas } from "./schema";
1010
import type { OpenApiDocument } from "@omer-x/openapi-types";
11+
import type { ServerObject } from "@omer-x/openapi-types/server";
1112
import type { ZodType } from "zod";
1213

1314
type GeneratorOptions = {
1415
include?: string[],
1516
exclude?: string[],
1617
routeDefinerName?: string,
1718
rootPath?: string,
19+
servers?: ServerObject[],
1820
};
1921

2022
export default async function generateOpenApiSpec(schemas: Record<string, ZodType>, {
2123
include: includeOption = [],
2224
exclude: excludeOption = [],
2325
routeDefinerName = "defineRoute",
2426
rootPath: additionalRootPath,
27+
servers,
2528
}: GeneratorOptions = {}) {
2629
const verifiedOptions = verifyOptions(includeOption, excludeOption);
2730
const appFolderPath = await findAppFolderPath();
@@ -59,6 +62,7 @@ export default async function generateOpenApiSpec(schemas: Record<string, ZodTyp
5962
title: metadata.serviceName,
6063
version: metadata.version,
6164
},
65+
servers,
6266
...clearUnusedSchemas(pathsAndComponents),
6367
tags: [],
6468
} as Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>;

0 commit comments

Comments
 (0)