Skip to content

Commit b8b0691

Browse files
committed
fix: normalize root path
1 parent c5bd497 commit b8b0691

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type AllMethods = [${paths.map((_, i) => `Methods${i}`).join(', ')}]`;
8484
path = path.replace(/\/_([^/@]+)(@[^/]+)?/g, '/{$1}');
8585
}
8686

87-
path = path.replace(config.input, '');
87+
path = path.replace(config.input, '') || '/';
8888

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

0 commit comments

Comments
 (0)