@@ -25,7 +25,11 @@ internal static partial class OpenApiV2Deserializer
2525 { "delete" , ( o , n , t ) => o . AddOperation ( HttpMethod . Delete , LoadOperation ( n , t ) ) } ,
2626 { "options" , ( o , n , t ) => o . AddOperation ( HttpMethod . Options , LoadOperation ( n , t ) ) } ,
2727 { "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
2831 { "patch" , ( o , n , t ) => o . AddOperation ( new HttpMethod ( "PATCH" ) , LoadOperation ( n , t ) ) } ,
32+ #endif
2933 {
3034 "parameters" ,
3135 LoadPathParameters
@@ -63,7 +67,13 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node,
6367 var requestBody = CreateRequestBody ( node . Context , bodyParameter ) ;
6468 foreach ( var opPair in pathItem . Operations . Where ( x => x . Value . RequestBody is null ) )
6569 {
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+ )
6777 {
6878 opPair . Value . RequestBody = requestBody ;
6979 }
@@ -77,13 +87,20 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node,
7787 var requestBody = CreateFormBody ( node . Context , formParameters ) ;
7888 foreach ( var opPair in pathItem . Operations . Where ( x => x . Value . RequestBody is null ) )
7989 {
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+ )
8197 {
8298 opPair . Value . RequestBody = requestBody ;
8399 }
84100 }
85101 }
86102 }
103+
87104 }
88105 }
89106}
0 commit comments