@@ -25,7 +25,11 @@ internal static partial class OpenApiV2Deserializer
25
25
{ "delete" , ( o , n , t ) => o . AddOperation ( HttpMethod . Delete , LoadOperation ( n , t ) ) } ,
26
26
{ "options" , ( o , n , t ) => o . AddOperation ( HttpMethod . Options , LoadOperation ( n , t ) ) } ,
27
27
{ "head" , ( o , n , t ) => o . AddOperation ( HttpMethod . Head , LoadOperation ( n , t ) ) } ,
28
+ #if NETSTANDARD2_1_OR_GREATER
29
+ { "patch" , ( o , n , t ) => o . AddOperation ( HttpMethod . Patch , LoadOperation ( n , t ) ) } ,
30
+ #else
28
31
{ "patch" , ( o , n , t ) => o . AddOperation ( new HttpMethod ( "PATCH" ) , LoadOperation ( n , t ) ) } ,
32
+ #endif
29
33
{
30
34
"parameters" ,
31
35
LoadPathParameters
@@ -63,7 +67,13 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node,
63
67
var requestBody = CreateRequestBody ( node . Context , bodyParameter ) ;
64
68
foreach ( var opPair in pathItem . Operations . Where ( x => x . Value . RequestBody is null ) )
65
69
{
66
- if ( opPair . Key == HttpMethod . Post || opPair . Key == HttpMethod . Put || opPair . Key == new HttpMethod ( "PATCH" ) )
70
+ if ( opPair . Key == HttpMethod . Post || opPair . Key == HttpMethod . Put
71
+ #if NETSTANDARD2_1_OR_GREATER
72
+ || opPair . Key == HttpMethod . Patch
73
+ #else
74
+ || opPair . Key == new HttpMethod ( "PATCH" )
75
+ #endif
76
+ )
67
77
{
68
78
opPair . Value . RequestBody = requestBody ;
69
79
}
@@ -77,13 +87,20 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node,
77
87
var requestBody = CreateFormBody ( node . Context , formParameters ) ;
78
88
foreach ( var opPair in pathItem . Operations . Where ( x => x . Value . RequestBody is null ) )
79
89
{
80
- if ( opPair . Key == HttpMethod . Post || opPair . Key == HttpMethod . Put || opPair . Key == new HttpMethod ( "PATCH" ) )
90
+ if ( opPair . Key == HttpMethod . Post || opPair . Key == HttpMethod . Put
91
+ #if NETSTANDARD2_1_OR_GREATER
92
+ || opPair . Key == HttpMethod . Patch
93
+ #else
94
+ || opPair . Key == new HttpMethod ( "PATCH" )
95
+ #endif
96
+ )
81
97
{
82
98
opPair . Value . RequestBody = requestBody ;
83
99
}
84
100
}
85
101
}
86
102
}
103
+
87
104
}
88
105
}
89
106
}
0 commit comments