Merge pull request #2519 from microsoft/fix/allow-reserved-to-v1 · microsoft/OpenAPI.NET@6eeca52 · GitHub
Skip to content

Commit 6eeca52

Browse files
authored
Merge pull request #2519 from microsoft/fix/allow-reserved-to-v1
fix: typo in encoding allow reserved deserialization
2 parents 63e0715 + 3fadb7d commit 6eeca52

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎src/Microsoft.OpenApi.Readers/V3/OpenApiEncodingDeserializer.cs‎

Lines changed: 1 addition & 1 deletion

‎test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,29 @@ public void ParseAdvancedEncodingShouldSucceed()
7676
}
7777
});
7878
}
79+
[Fact]
80+
public void ParseEncodingWithAllowReservedShouldSucceed()
81+
{
82+
using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "encodingWithAllowReserved.yaml"));
83+
var yamlStream = new YamlStream();
84+
yamlStream.Load(new StreamReader(stream));
85+
var yamlNode = yamlStream.Documents.First().RootNode;
86+
87+
var diagnostic = new OpenApiDiagnostic();
88+
var context = new ParsingContext(diagnostic);
89+
90+
var node = new MapNode(context, (YamlMappingNode)yamlNode);
91+
var encoding = OpenApiV3Deserializer.LoadEncoding(node);
92+
93+
// Assert
94+
Assert.Equivalent(
95+
new OpenApiEncoding
96+
{
97+
ContentType = "application/x-www-form-urlencoded",
98+
Style = ParameterStyle.Form,
99+
Explode = true,
100+
AllowReserved = true
101+
}, encoding);
102+
}
79103
}
80104
}
Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)