Skip to content

Commit e415a80

Browse files
committed
Fix tide path prefix
1 parent ccc49f3 commit e415a80

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

website/src/utils/openapi.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@ type Parameters = NonNullable<Components["parameters"]>;
77
type ParameterObject = Parameters[keyof Parameters];
88

99
/**
10-
* Fetch OpenAPI spec from @neaps/api at build time
10+
* Path prefix where the neaps API is mounted in the Open Waters API.
11+
* Mirrors what neaps does internally with `servers: [{ url: prefix }]`.
12+
*/
13+
const NEAPS_PREFIX = "/tides";
14+
15+
/**
16+
* Fetch OpenAPI spec from @neaps/api at build time, prefixing paths with the
17+
* mount point used by the Open Waters API.
1118
*/
1219
export async function getOpenAPISpec(): Promise<OpenAPISpec> {
1320
const { openapi } = await import("@neaps/api");
14-
return openapi;
21+
const paths = Object.fromEntries(
22+
Object.entries(openapi.paths).map(([path, pathItem]) => [
23+
path === "/" ? NEAPS_PREFIX : `${NEAPS_PREFIX}${path}`,
24+
pathItem,
25+
]),
26+
);
27+
return { ...openapi, paths } as OpenAPISpec;
1528
}
1629

1730
/**

0 commit comments

Comments
 (0)