@@ -6,7 +6,7 @@ import Parameter from './Parameter';
6
6
import { EXEGESIS_CONTROLLER } from './extensions' ;
7
7
8
8
// CONNECT not included, as it is not valid for OpenAPI 3.0.1.
9
- const HTTP_METHODS = [ 'GET ' , 'HEAD ' , 'POST ' , 'PUT ' , 'DELETE ' , 'OPTIONS ' , 'TRACE ' , 'PATCH' ] ;
9
+ const HTTP_METHODS = [ 'get ' , 'head ' , 'post ' , 'put ' , 'delete ' , 'options ' , 'trace ' , 'patch' ] as const ;
10
10
11
11
interface OperationsMap {
12
12
[ key : string ] : Operation ;
@@ -33,19 +33,20 @@ export default class Path {
33
33
) ;
34
34
35
35
exegesisController = oaPath [ EXEGESIS_CONTROLLER ] || exegesisController ;
36
- this . _operations = HTTP_METHODS . map ( ( method ) => method . toLowerCase ( ) )
37
- . filter ( ( method ) => oaPath [ method ] )
38
- . reduce ( ( result : OperationsMap , method : string ) => {
36
+ this . _operations = HTTP_METHODS . reduce ( ( result : OperationsMap , method ) => {
37
+ const operation = oaPath [ method ] ;
38
+ if ( operation ) {
39
39
result [ method ] = new Operation (
40
40
context . childContext ( method ) ,
41
- oaPath [ method ] ,
41
+ operation ,
42
42
oaPath ,
43
43
method ,
44
44
exegesisController ,
45
45
parameters
46
46
) ;
47
- return result ;
48
- } , Object . create ( null ) ) ;
47
+ }
48
+ return result ;
49
+ } , Object . create ( null ) ) ;
49
50
}
50
51
51
52
getOperation ( method : string ) : Operation | undefined {
0 commit comments