@@ -10,15 +10,18 @@ namespace Microsoft.OpenApi
1010 /// <summary>
1111 /// Request Body Object
1212 /// </summary>
13- public class OpenApiRequestBody : IOpenApiExtensible , IOpenApiRequestBody
13+ public class OpenApiRequestBody : IOpenApiExtensible , IOpenApiRequestBody , IOpenApiContentElement
1414 {
1515 /// <inheritdoc />
1616 public string ? Description { get ; set ; }
1717
1818 /// <inheritdoc />
1919 public bool Required { get ; set ; }
2020
21- /// <inheritdoc />
21+ /// <summary>
22+ /// REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it.
23+ /// For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
24+ /// </summary>
2225 public IDictionary < string , OpenApiMediaType > ? Content { get ; set ; }
2326
2427 /// <inheritdoc />
@@ -56,7 +59,7 @@ public virtual void SerializeAsV3(IOpenApiWriter writer)
5659 {
5760 SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
5861 }
59-
62+
6063 internal void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
6164 Action < IOpenApiWriter , IOpenApiSerializable > callback )
6265 {
@@ -102,7 +105,7 @@ public IOpenApiParameter ConvertToBodyParameter(IOpenApiWriter writer)
102105 Extensions = Extensions ? . ToDictionary ( static k => k . Key , static v => v . Value )
103106 } ;
104107 // Clone extensions so we can remove the x-bodyName extensions from the output V2 model.
105- if ( bodyParameter . Extensions is not null &&
108+ if ( bodyParameter . Extensions is not null &&
106109 bodyParameter . Extensions . TryGetValue ( OpenApiConstants . BodyName , out var bodyNameExtension ) &&
107110 bodyNameExtension is JsonNodeExtension bodyName )
108111 {
@@ -118,7 +121,7 @@ public IEnumerable<IOpenApiParameter> ConvertToFormDataParameters(IOpenApiWriter
118121 if ( Content == null || ! Content . Any ( ) )
119122 yield break ;
120123 var properties = Content . First ( ) . Value . Schema ? . Properties ;
121- if ( properties != null )
124+ if ( properties != null )
122125 {
123126 foreach ( var property in properties )
124127 {
@@ -136,11 +139,11 @@ public IEnumerable<IOpenApiParameter> ConvertToFormDataParameters(IOpenApiWriter
136139 OpenApiSchemaReference => throw new InvalidOperationException ( "Unresolved reference target" ) ,
137140 _ => throw new InvalidOperationException ( "Unexpected schema type" )
138141 } ;
139-
142+
140143 updatedSchema . Type = "file" . ToJsonSchemaType ( ) ;
141144 updatedSchema . Format = null ;
142145 paramSchema = updatedSchema ;
143-
146+
144147 }
145148 yield return new OpenApiFormDataParameter ( )
146149 {
@@ -151,7 +154,7 @@ public IEnumerable<IOpenApiParameter> ConvertToFormDataParameters(IOpenApiWriter
151154 Required = Content . First ( ) . Value . Schema ? . Required ? . Contains ( property . Key ) ?? false
152155 } ;
153156 }
154- }
157+ }
155158 }
156159
157160 /// <inheritdoc/>
0 commit comments