Skip to content

Commit

Permalink
fix: normalize root path
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Aug 16, 2024
1 parent c5bd497 commit b8b0691
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type AllMethods = [${paths.map((_, i) => `Methods${i}`).join(', ')}]`;
path = path.replace(/\/_([^/@]+)(@[^/]+)?/g, '/{$1}');
}

path = path.replace(config.input, '');
path = path.replace(config.input, '') || '/';

doc.paths![path] = Object.entries(def.properties!).reduce((dict, [method, val]) => {
const params = [...parameters];
Expand Down Expand Up @@ -122,7 +122,7 @@ type AllMethods = [${paths.map((_, i) => `Methods${i}`).join(', ')}]`;
return {
...dict,
[method]: {
tags: path.replace(config.input, '').split('/{')[0].replace(/^\//, '').split('/'),
tags: path === '/' ? undefined : path.split('/{')[0].replace(/^\//, '').split('/'),
parameters: params,
requestBody:
props.reqBody === undefined
Expand Down

0 comments on commit b8b0691

Please sign in to comment.