File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import { pascalCase } from "change-case" ;
3
+ import type { Endpoint } from "generate-routes.js"
4
+
5
+ const generateDocstringForEndpoint = ( endpoint : Endpoint ) : string => {
6
+ const responseType = `${ pascalCase ( endpoint . namespace ) } ${ pascalCase ( endpoint . name ) } Response` ;
7
+ const paramType = endpoint . requestFormat === 'params' ? 'ParamsType' : 'BodyType' ;
8
+
9
+
10
+ return `
11
+ /**
12
+ * Handles ${ endpoint . method } requests to ${ endpoint . path } .
13
+ *
14
+ * @param {${ paramType } } request - The request ${ endpoint . requestFormat } .
15
+ * @returns {Promise<${ responseType } >}
16
+ */
17
+ ` ;
18
+ } ;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ interface Route {
94
94
subresources : string [ ]
95
95
}
96
96
97
- interface Endpoint {
97
+ export interface Endpoint {
98
98
name : string
99
99
path : string
100
100
namespace : string
Original file line number Diff line number Diff line change 37
37
" examples/**/*" ,
38
38
" tsup.config.ts" ,
39
39
" prepack.ts" ,
40
- " generate-routes.ts"
40
+ " generate-routes.ts" ,
41
+ " generate-docstrings.ts"
41
42
]
42
43
}
You can’t perform that action at this time.
0 commit comments