@@ -8,20 +8,23 @@ import { verifyOptions } from "./options";
88import { type RouteRecord , bundlePaths , createRouteRecord } from "./route" ;
99import { bundleSchemas } from "./schema" ;
1010import type { OpenApiDocument } from "@omer-x/openapi-types" ;
11+ import type { ServerObject } from "@omer-x/openapi-types/server" ;
1112import type { ZodType } from "zod" ;
1213
1314type GeneratorOptions = {
1415 include ?: string [ ] ,
1516 exclude ?: string [ ] ,
1617 routeDefinerName ?: string ,
1718 rootPath ?: string ,
19+ servers ?: ServerObject [ ] ,
1820} ;
1921
2022export 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