Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<PackageId>Microsoft.OpenApi.OData</PackageId>
<SignAssembly>true</SignAssembly>
<Version>1.5.0-preview5</Version>
<Version>1.5.0-preview6</Version>
<Description>This package contains the codes you need to convert OData CSDL to Open API Document of Model.</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>Microsoft OpenApi OData EDM</PackageTags>
Expand All @@ -26,6 +26,7 @@
- Fixes casing in default propertyName for `innerError` in the `ErrorMainSchema`
- Adds support for `x-ms-enum-flags` extension for flagged enums
- Use containment together with RequiresExplicitBinding annotation to check whether to append bound operations to navigation properties #430
- Adds schema to content types of stream properties that have a collection of acceptable media types #435
</PackageReleaseNotes>
<AssemblyName>Microsoft.OpenApi.OData.Reader</AssemblyName>
<AssemblyOriginatorKeyFile>..\..\tool\Microsoft.OpenApi.OData.snk</AssemblyOriginatorKeyFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,6 @@ protected string GetOperationId(string prefix, string identifier)
/// <returns>The entity content description.</returns>
protected IDictionary<string, OpenApiMediaType> GetContentDescription()
{
var content = new Dictionary<string, OpenApiMediaType>();

OpenApiSchema schema = new OpenApiSchema
{
Type = "string",
Format = "binary"
};

// Fetch the respective AcceptableMediaTypes
(_, var property) = GetStreamElements();
IEnumerable<string> mediaTypes = null;
Expand All @@ -153,11 +145,21 @@ protected IDictionary<string, OpenApiMediaType> GetContentDescription()
CoreConstants.AcceptableMediaTypes);
}

OpenApiSchema schema = new()
{
Type = "string",
Format = "binary"
};

var content = new Dictionary<string, OpenApiMediaType>();
if (mediaTypes != null)
{
foreach (string item in mediaTypes)
{
content.Add(item, null);
content.Add(item, new OpenApiMediaType
{
Schema = schema
});
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ private void VerifyMediaEntityGetOperation(string annotation, bool enableOperati
var statusCode = useHTTPStatusCodeClass2XX ? Constants.StatusCodeClass2XX : Constants.StatusCode200;
Assert.Equal(new[] { statusCode, "default" }, getOperation.Responses.Select(r => r.Key));
Assert.Equal(new[] { statusCode, "default" }, getOperation2.Responses.Select(r => r.Key));
Assert.NotNull(getOperation.Responses[statusCode].Content.Values?.Select(x => x.Schema));

foreach (var item in getOperation.Responses[statusCode].Content)
{
Assert.Equal("binary", item.Value.Schema.Format);
Assert.Equal("string", item.Value.Schema.Type);
}

if (!string.IsNullOrEmpty(annotation))
{
Expand Down