Skip to content

Commit

Permalink
refactor(openapi): fix route version handling logic (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosch authored Jan 13, 2025
1 parent 0649d93 commit 208bd4b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/zudoku/src/lib/plugins/openapi/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
return [];
}
},
getRoutes: () => [
{
path: basePath + "/:version?",
getRoutes: () => {
const versionsInPath = [null, ...versions];

return versionsInPath.map((version) => ({
path: basePath + (version ? `/${version}` : ""),
async lazy() {
const { OpenApiRoute } = await import("./Route.js");
return {
Expand All @@ -191,7 +193,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
},
},
],
},
],
}));
},
};
};

0 comments on commit 208bd4b

Please sign in to comment.