File tree Expand file tree Collapse file tree 2 files changed +71
-4
lines changed Expand file tree Collapse file tree 2 files changed +71
-4
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,70 @@ test('top', () => {
6060 }"
6161 ` ) ;
6262} ) ;
63+
64+ test ( 'ignore miss path parameter' , ( ) => {
65+ const printer = new Printer ( {
66+ openapi : '3.1.0' ,
67+ info : {
68+ title : 'test' ,
69+ version : '1.0.0' ,
70+ } ,
71+ paths : {
72+ '/' : {
73+ get : {
74+ parameters : [
75+ {
76+ in : 'path' ,
77+ name : 'id' ,
78+ deprecated : true ,
79+ description : 'request param' ,
80+ schema : {
81+ type : 'string' ,
82+ description : 'test7' ,
83+ deprecated : true ,
84+ default : 'test8' ,
85+ example : 'test9' ,
86+ } ,
87+ } ,
88+ ] ,
89+ requestBody : {
90+ content : {
91+ '*' : {
92+ schema : {
93+ type : 'string' ,
94+ description : 'test4' ,
95+ deprecated : true ,
96+ default : 'test5' ,
97+ example : 'test6' ,
98+ } ,
99+ } ,
100+ } ,
101+ } ,
102+ } ,
103+ } ,
104+ } ,
105+ } ) ;
106+
107+ expect (
108+ printer . print ( {
109+ hideImports : true ,
110+ hideHeaders : true ,
111+ hideFooters : true ,
112+ hideInfo : true ,
113+ hideHelpers : true ,
114+ } ) ,
115+ ) . toMatchInlineSnapshot ( `
116+ "/**
117+ * @param data test4
118+ * @param [config] request config
119+ */
120+ export async function get_2(data:string,config?:AxiosRequestConfig): AxiosPromise<unknown> {
121+ return axios({
122+ method: "get",
123+ url: \`/\`,
124+ data: data,
125+ ...config
126+ });
127+ }"
128+ ` ) ;
129+ } ) ;
Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ test('1路径 + 1请求 + 2query + 1path + 1request primitive', () => {
510510 } ,
511511 openapi : '3.1.0' ,
512512 paths : {
513- '/api/abc' : {
513+ '/api/abc/{c} ' : {
514514 get : {
515515 parameters : [
516516 {
@@ -583,7 +583,7 @@ test('1路径 + 1请求 + 2query + 1path + 1request primitive', () => {
583583 },data:string,config?:AxiosRequestConfig): AxiosPromise<unknown> {
584584 return axios({
585585 method: "get",
586- url: \`/api/abc\`,
586+ url: \`/api/abc/\${c} \`,
587587 params: params,
588588 data: data,
589589 ...config
@@ -600,7 +600,7 @@ test('1路径 + 1请求 + 2query + 1path + 1request object', () => {
600600 } ,
601601 openapi : '3.1.0' ,
602602 paths : {
603- '/api/abc' : {
603+ '/api/abc/{c} ' : {
604604 get : {
605605 parameters : [
606606 {
@@ -685,7 +685,7 @@ test('1路径 + 1请求 + 2query + 1path + 1request object', () => {
685685 },config?:AxiosRequestConfig): AxiosPromise<unknown> {
686686 return axios({
687687 method: "get",
688- url: \`/api/abc\`,
688+ url: \`/api/abc/\${c} \`,
689689 params: params,
690690 data: data,
691691 ...config
You can’t perform that action at this time.
0 commit comments