33
44using System . IO ;
55using FluentAssertions ;
6+ using Microsoft . OpenApi . Any ;
67using Microsoft . OpenApi . Extensions ;
78using Microsoft . OpenApi . Models ;
89using Microsoft . OpenApi . Writers ;
@@ -30,7 +31,8 @@ public class OpenApiResponseTests
3031 {
3132 Reference = new OpenApiReference { Type = ReferenceType . Schema , Id = "customType" }
3233 }
33- }
34+ } ,
35+ Example = new OpenApiString ( "Blabla" )
3436 }
3537 } ,
3638 Headers =
@@ -147,7 +149,8 @@ public void SerializeAdvancedResponseAsV3JsonWorks()
147149 ""items"": {
148150 ""$ref"": ""#/components/schemas/customType""
149151 }
150- }
152+ },
153+ ""example"": ""Blabla""
151154 }
152155 }
153156}" ;
@@ -181,7 +184,8 @@ public void SerializeAdvancedResponseAsV3YamlWorks()
181184 schema:
182185 type: array
183186 items:
184- $ref: '#/components/schemas/customType'" ;
187+ $ref: '#/components/schemas/customType'
188+ example: Blabla" ;
185189
186190 // Act
187191 var actual = AdvancedResponse . SerializeAsYaml ( OpenApiSpecVersion . OpenApi3_0 ) ;
@@ -204,6 +208,9 @@ public void SerializeAdvancedResponseAsV2JsonWorks()
204208 ""$ref"": ""#/definitions/customType""
205209 }
206210 },
211+ ""examples"": {
212+ ""text/plain"": ""Blabla""
213+ },
207214 ""headers"": {
208215 ""X-Rate-Limit-Limit"": {
209216 ""description"": ""The number of allowed requests in the current period"",
@@ -239,6 +246,8 @@ public void SerializeAdvancedResponseAsV2YamlWorks()
239246 type: array
240247 items:
241248 $ref: '#/definitions/customType'
249+ examples:
250+ text/plain: Blabla
242251headers:
243252 X-Rate-Limit-Limit:
244253 description: The number of allowed requests in the current period
0 commit comments