11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license.
33
4+ using System . Collections . Generic ;
45using System . Globalization ;
56using System . IO ;
67using FluentAssertions ;
78using Microsoft . OpenApi . Any ;
89using Microsoft . OpenApi . Extensions ;
10+ using Microsoft . OpenApi . Interfaces ;
911using Microsoft . OpenApi . Models ;
1012using Microsoft . OpenApi . Writers ;
1113using Xunit ;
@@ -33,7 +35,11 @@ public class OpenApiResponseTests
3335 Reference = new OpenApiReference { Type = ReferenceType . Schema , Id = "customType" }
3436 }
3537 } ,
36- Example = new OpenApiString ( "Blabla" )
38+ Example = new OpenApiString ( "Blabla" ) ,
39+ Extensions = new Dictionary < string , IOpenApiExtension >
40+ {
41+ [ "myextension" ] = new OpenApiString ( "myextensionvalue" ) ,
42+ } ,
3743 }
3844 } ,
3945 Headers =
@@ -158,7 +164,8 @@ public void SerializeAdvancedResponseAsV3JsonWorks()
158164 ""$ref"": ""#/components/schemas/customType""
159165 }
160166 },
161- ""example"": ""Blabla""
167+ ""example"": ""Blabla"",
168+ ""myextension"": ""myextensionvalue""
162169 }
163170 }
164171}" ;
@@ -193,7 +200,8 @@ public void SerializeAdvancedResponseAsV3YamlWorks()
193200 type: array
194201 items:
195202 $ref: '#/components/schemas/customType'
196- example: Blabla" ;
203+ example: Blabla
204+ myextension: myextensionvalue" ;
197205
198206 // Act
199207 var actual = AdvancedResponse . SerializeAsYaml ( OpenApiSpecVersion . OpenApi3_0 ) ;
@@ -219,6 +227,7 @@ public void SerializeAdvancedResponseAsV2JsonWorks()
219227 ""examples"": {
220228 ""text/plain"": ""Blabla""
221229 },
230+ ""myextension"": ""myextensionvalue"",
222231 ""headers"": {
223232 ""X-Rate-Limit-Limit"": {
224233 ""description"": ""The number of allowed requests in the current period"",
@@ -252,6 +261,7 @@ public void SerializeAdvancedResponseAsV2YamlWorks()
252261 $ref: '#/definitions/customType'
253262examples:
254263 text/plain: Blabla
264+ myextension: myextensionvalue
255265headers:
256266 X-Rate-Limit-Limit:
257267 description: The number of allowed requests in the current period
0 commit comments