File tree Expand file tree Collapse file tree 2 files changed +63
-15
lines changed Expand file tree Collapse file tree 2 files changed +63
-15
lines changed Original file line number Diff line number Diff line change @@ -51,21 +51,21 @@ export const KEYWORD_VARS = [
5151 'namespace' ,
5252 'async' ,
5353 'await' ,
54- // 上下文关键字
55- 'any' ,
56- 'boolean' ,
57- 'constructor' ,
58- 'declare' ,
59- 'get' ,
60- 'module' ,
61- 'require' ,
62- 'number' ,
63- 'set' ,
64- 'string' ,
65- 'symbol' ,
66- 'type' ,
67- 'from' ,
68- 'of' ,
54+ // // 上下文关键字
55+ // 'any',
56+ // 'boolean',
57+ // 'constructor',
58+ // 'declare',
59+ // 'get',
60+ // 'module',
61+ // 'require',
62+ // 'number',
63+ // 'set',
64+ // 'string',
65+ // 'symbol',
66+ // 'type',
67+ // 'from',
68+ // 'of',
6969] ;
7070
7171export const AXIOS_IMPORT_NAME = 'axios' ;
Original file line number Diff line number Diff line change @@ -367,3 +367,51 @@ it('n*path + n*query + n*header', () => {
367367 }"
368368 ` ) ;
369369} ) ;
370+
371+ it ( 'path name unique' , ( ) => {
372+ const printer = new Printer ( {
373+ openapi : '3.1.0' ,
374+ info : {
375+ title : 'test' ,
376+ version : '1.0.0' ,
377+ } ,
378+ paths : {
379+ '/pets/{type}' : {
380+ get : {
381+ operationId : 'getPet' ,
382+ parameters : [
383+ {
384+ in : 'path' ,
385+ name : 'type' ,
386+ schema : {
387+ type : 'string' ,
388+ } ,
389+ } ,
390+ ] ,
391+ } ,
392+ } ,
393+ } ,
394+ } ) ;
395+
396+ expect (
397+ printer . print ( {
398+ hideImports : true ,
399+ hideHeaders : true ,
400+ hideFooters : true ,
401+ hideInfo : true ,
402+ hideHelpers : true ,
403+ } ) ,
404+ ) . toMatchInlineSnapshot ( `
405+ "/**
406+ * @param type request path "type"
407+ * @param [config] request config
408+ */
409+ export async function getPet(type:string,config?:AxiosRequestConfig): AxiosPromise<unknown> {
410+ return axios({
411+ method: "get",
412+ url: \`/pets/\${type}\`,
413+ ...config
414+ });
415+ }"
416+ ` ) ;
417+ } ) ;
You can’t perform that action at this time.
0 commit comments