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 {
129
129
) ;
130
130
131
131
const queryParamMatches = fixedRoute . match ( / ( \{ \? .* \} ) / g) ;
132
+ const queryParams = [ ] ;
132
133
133
134
if ( queryParamMatches && queryParamMatches . length ) {
134
135
queryParamMatches . forEach ( ( match ) => {
135
136
fixedRoute = fixedRoute . replace ( match , "" ) ;
136
137
} ) ;
137
- }
138
138
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
+ }
148
148
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 ,
156
153
type : "string" ,
157
- } ,
158
- in : "query" ,
154
+ description : "" ,
155
+ schema : {
156
+ type : "string" ,
157
+ } ,
158
+ in : "query" ,
159
+ } ) ;
159
160
} ) ;
160
-
161
- return acc ;
162
- } , [ ] ) ;
161
+ }
163
162
164
163
return {
165
164
originalRoute : routeName || "" ,
You can’t perform that action at this time.
0 commit comments