diff --git a/test/Microsoft.OpenApi.Readers.Tests/V32Tests/OpenApiEncodingTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V32Tests/OpenApiEncodingTests.cs new file mode 100644 index 000000000..ac761c991 --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V32Tests/OpenApiEncodingTests.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.IO; +using System.Threading.Tasks; +using Microsoft.OpenApi.Reader; +using Xunit; + +namespace Microsoft.OpenApi.Readers.Tests.V32Tests +{ + [Collection("DefaultSettings")] + public class OpenApiEncodingTests + { + private const string SampleFolderPath = "V32Tests/Samples/OpenApiEncoding/"; + + [Fact] + public async Task ParseEncodingWithAllowReservedShouldSucceed() + { + // Act + var encoding = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "encodingWithAllowReserved.yaml"), OpenApiSpecVersion.OpenApi3_2, new(), SettingsFixture.ReaderSettings); + + // Assert + Assert.Equivalent( + new OpenApiEncoding + { + ContentType = "application/x-www-form-urlencoded", + Style = ParameterStyle.Form, + Explode = true, + AllowReserved = true + }, encoding); + } + } +} diff --git a/test/Microsoft.OpenApi.Readers.Tests/V32Tests/Samples/OpenApiEncoding/encodingWithAllowReserved.yaml b/test/Microsoft.OpenApi.Readers.Tests/V32Tests/Samples/OpenApiEncoding/encodingWithAllowReserved.yaml new file mode 100644 index 000000000..1e6c47865 --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V32Tests/Samples/OpenApiEncoding/encodingWithAllowReserved.yaml @@ -0,0 +1,5 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.2.0.md#encodingObject +contentType: application/x-www-form-urlencoded +style: form +explode: true +allowReserved: true