File tree Expand file tree Collapse file tree 1 file changed +55
-1
lines changed
test/Microsoft.OpenApi.Tests/Models Expand file tree Collapse file tree 1 file changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -992,7 +992,7 @@ public OpenApiDocumentTests()
992
992
{
993
993
[ "my-extension" ] = new OpenApiAny ( 4 )
994
994
}
995
- } ,
995
+ } ,
996
996
Extensions = new Dictionary < string , IOpenApiExtension >
997
997
{
998
998
[ "my-extension" ] = new OpenApiAny ( 4 ) ,
@@ -2072,5 +2072,59 @@ public void SerializeDocWithDollarIdInDollarRefSucceeds()
2072
2072
var actual = doc . SerializeAsYaml ( OpenApiSpecVersion . OpenApi3_1 ) ;
2073
2073
actual . MakeLineBreaksEnvironmentNeutral ( ) . Should ( ) . BeEquivalentTo ( expected . MakeLineBreaksEnvironmentNeutral ( ) ) ;
2074
2074
}
2075
+
2076
+ [ Fact ]
2077
+ public void SerializeDocumentTagsWithMultipleExtensionsWorks ( )
2078
+ {
2079
+ var expected = @"{
2080
+ ""openapi"": ""3.0.4"",
2081
+ ""info"": {
2082
+ ""title"": ""Test"",
2083
+ ""version"": ""1.0.0""
2084
+ },
2085
+ ""paths"": { },
2086
+ ""tags"": [
2087
+ {
2088
+ ""name"": ""tag1"",
2089
+ ""x-tag1"": ""tag1""
2090
+ },
2091
+ {
2092
+ ""name"": ""tag2"",
2093
+ ""x-tag2"": ""tag2""
2094
+ }
2095
+ ]
2096
+ }" ;
2097
+ var doc = new OpenApiDocument
2098
+ {
2099
+ Info = new OpenApiInfo
2100
+ {
2101
+ Title = "Test" ,
2102
+ Version = "1.0.0"
2103
+ } ,
2104
+ Paths = new OpenApiPaths ( ) ,
2105
+ Tags = new List < OpenApiTag >
2106
+ {
2107
+ new OpenApiTag
2108
+ {
2109
+ Name = "tag1" ,
2110
+ Extensions = new Dictionary < string , IOpenApiExtension >
2111
+ {
2112
+ [ "x-tag1" ] = new OpenApiAny ( "tag1" )
2113
+ }
2114
+ } ,
2115
+ new OpenApiTag
2116
+ {
2117
+ Name = "tag2" ,
2118
+ Extensions = new Dictionary < string , IOpenApiExtension >
2119
+ {
2120
+ [ "x-tag2" ] = new OpenApiAny ( "tag2" )
2121
+ }
2122
+ }
2123
+ }
2124
+ } ;
2125
+
2126
+ var actual = doc . SerializeAsJson ( OpenApiSpecVersion . OpenApi3_0 ) ;
2127
+ actual . MakeLineBreaksEnvironmentNeutral ( ) . Should ( ) . BeEquivalentTo ( expected . MakeLineBreaksEnvironmentNeutral ( ) ) ;
2128
+ }
2075
2129
}
2076
2130
}
You can’t perform that action at this time.
0 commit comments