File tree Expand file tree Collapse file tree 1 file changed +21
-22
lines changed Expand file tree Collapse file tree 1 file changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -129,37 +129,36 @@ class SchemaRoutes {
129129 ) ;
130130
131131 const queryParamMatches = fixedRoute . match ( / ( \{ \? .* \} ) / g) ;
132+ const queryParams = [ ] ;
132133
133134 if ( queryParamMatches && queryParamMatches . length ) {
134135 queryParamMatches . forEach ( ( match ) => {
135136 fixedRoute = fixedRoute . replace ( match , "" ) ;
136137 } ) ;
137- }
138138
139- const queryParams = _ . uniq (
140- queryParamMatches
141- . join ( "," )
142- . replace ( / ( \{ \? ) | ( \} ) | \s / g, "" )
143- . split ( "," ) ,
144- ) . reduce ( ( acc , paramName ) => {
145- if ( _ . includes ( paramName , "-" ) ) {
146- this . logger . warn ( "wrong query param name" , paramName ) ;
147- }
139+ _ . uniq (
140+ queryParamMatches
141+ . join ( "," )
142+ . replace ( / ( \{ \? ) | ( \} ) | \s / g, "" )
143+ . split ( "," ) ,
144+ ) . forEach ( ( paramName ) => {
145+ if ( _ . includes ( paramName , "-" ) ) {
146+ this . logger . warn ( "wrong query param name" , paramName ) ;
147+ }
148148
149- acc . push ( {
150- $match : paramName ,
151- name : _ . camelCase ( paramName ) ,
152- required : true ,
153- type : "string" ,
154- description : "" ,
155- schema : {
149+ queryParams . push ( {
150+ $match : paramName ,
151+ name : _ . camelCase ( paramName ) ,
152+ required : true ,
156153 type : "string" ,
157- } ,
158- in : "query" ,
154+ description : "" ,
155+ schema : {
156+ type : "string" ,
157+ } ,
158+ in : "query" ,
159+ } ) ;
159160 } ) ;
160-
161- return acc ;
162- } , [ ] ) ;
161+ }
163162
164163 return {
165164 originalRoute : routeName || "" ,
You can’t perform that action at this time.
0 commit comments