3
3
4
4
using System . IO ;
5
5
using FluentAssertions ;
6
+ using Microsoft . OpenApi . Any ;
6
7
using Microsoft . OpenApi . Extensions ;
7
8
using Microsoft . OpenApi . Models ;
8
9
using Microsoft . OpenApi . Writers ;
@@ -30,7 +31,8 @@ public class OpenApiResponseTests
30
31
{
31
32
Reference = new OpenApiReference { Type = ReferenceType . Schema , Id = "customType" }
32
33
}
33
- }
34
+ } ,
35
+ Example = new OpenApiString ( "Blabla" )
34
36
}
35
37
} ,
36
38
Headers =
@@ -147,7 +149,8 @@ public void SerializeAdvancedResponseAsV3JsonWorks()
147
149
""items"": {
148
150
""$ref"": ""#/components/schemas/customType""
149
151
}
150
- }
152
+ },
153
+ ""example"": ""Blabla""
151
154
}
152
155
}
153
156
}" ;
@@ -181,7 +184,8 @@ public void SerializeAdvancedResponseAsV3YamlWorks()
181
184
schema:
182
185
type: array
183
186
items:
184
- $ref: '#/components/schemas/customType'" ;
187
+ $ref: '#/components/schemas/customType'
188
+ example: Blabla" ;
185
189
186
190
// Act
187
191
var actual = AdvancedResponse . SerializeAsYaml ( OpenApiSpecVersion . OpenApi3_0 ) ;
@@ -204,6 +208,9 @@ public void SerializeAdvancedResponseAsV2JsonWorks()
204
208
""$ref"": ""#/definitions/customType""
205
209
}
206
210
},
211
+ ""examples"": {
212
+ ""text/plain"": ""Blabla""
213
+ },
207
214
""headers"": {
208
215
""X-Rate-Limit-Limit"": {
209
216
""description"": ""The number of allowed requests in the current period"",
@@ -239,6 +246,8 @@ public void SerializeAdvancedResponseAsV2YamlWorks()
239
246
type: array
240
247
items:
241
248
$ref: '#/definitions/customType'
249
+ examples:
250
+ text/plain: Blabla
242
251
headers:
243
252
X-Rate-Limit-Limit:
244
253
description: The number of allowed requests in the current period
0 commit comments