Skip to content

Commit 6c5f86f

Browse files
committed
test: fixes media type inlining behaviour based on settings
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 78458e8 commit 6c5f86f

7 files changed

+81
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"openapi": "3.1.2",
3+
"info": {
4+
"title": "Test API",
5+
"version": "1.0.0"
6+
},
7+
"paths": {
8+
"/test": {
9+
"post": {
10+
"requestBody": {
11+
"content": {
12+
"application/json": {
13+
"schema": {
14+
"type": "object"
15+
}
16+
}
17+
}
18+
},
19+
"responses": { }
20+
}
21+
}
22+
},
23+
"components": { }
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.1.2","info":{"title":"Test API","version":"1.0.0"},"paths":{"/test":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{}}}},"components":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"openapi": "3.2.0",
3+
"info": {
4+
"title": "Test API",
5+
"version": "1.0.0"
6+
},
7+
"paths": {
8+
"/test": {
9+
"post": {
10+
"requestBody": {
11+
"content": {
12+
"application/json": {
13+
"schema": {
14+
"type": "object"
15+
}
16+
}
17+
}
18+
},
19+
"responses": { }
20+
}
21+
}
22+
},
23+
"components": { }
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.2.0","info":{"title":"Test API","version":"1.0.0"},"paths":{"/test":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{}}}},"components":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"openapi": "3.0.4",
3+
"info": {
4+
"title": "Test API",
5+
"version": "1.0.0"
6+
},
7+
"paths": {
8+
"/test": {
9+
"post": {
10+
"requestBody": {
11+
"content": {
12+
"application/json": {
13+
"schema": {
14+
"type": "object"
15+
}
16+
}
17+
}
18+
},
19+
"responses": { }
20+
}
21+
}
22+
},
23+
"components": { }
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.0.4","info":{"title":"Test API","version":"1.0.0"},"paths":{"/test":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{}}}},"components":{}}

test/Microsoft.OpenApi.Tests/Models/References/OpenApiMediaTypeReferenceTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,15 @@ public async Task SerializeMediaTypeReferenceAsV32JsonWorks(bool produceTerseOut
233233
{
234234
Content = new Dictionary<string, IOpenApiMediaType>()
235235
{
236-
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType", null)
236+
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType")
237237
}
238238
}
239239
}
240240
}
241241
}
242242
}
243243
};
244+
document.SetReferenceHostDocument();
244245
document.Workspace.RegisterComponents(document);
245246

246247
var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
@@ -297,14 +298,15 @@ public async Task SerializeMediaTypeReferenceAsV31JsonWorks(bool produceTerseOut
297298
{
298299
Content = new Dictionary<string, IOpenApiMediaType>()
299300
{
300-
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType", null)
301+
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType")
301302
}
302303
}
303304
}
304305
}
305306
}
306307
}
307308
};
309+
document.SetReferenceHostDocument();
308310
document.Workspace.RegisterComponents(document);
309311

310312
var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
@@ -361,14 +363,15 @@ public async Task SerializeMediaTypeReferenceAsV3JsonWorks(bool produceTerseOutp
361363
{
362364
Content = new Dictionary<string, IOpenApiMediaType>()
363365
{
364-
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType", null)
366+
["application/json"] = new OpenApiMediaTypeReference("JsonMediaType")
365367
}
366368
}
367369
}
368370
}
369371
}
370372
}
371373
};
374+
document.SetReferenceHostDocument();
372375
document.Workspace.RegisterComponents(document);
373376

374377
var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);

0 commit comments

Comments
 (0)