You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -397,6 +468,15 @@ public void WriteInlineSchema()
397
468
["thing"]=thingSchema}
398
469
}
399
470
};
471
+
returndoc;
472
+
}
473
+
474
+
[Fact]
475
+
476
+
publicvoidWriteInlineRecursiveSchema()
477
+
{
478
+
// Arrange
479
+
vardoc=CreateDocWithRecursiveSchemaReference();
400
480
401
481
varexpected=
402
482
@"openapi: 3.0.1
@@ -413,10 +493,29 @@ public void WriteInlineSchema()
413
493
application/json:
414
494
schema:
415
495
type: object
416
-
components: { }";
496
+
properties:
497
+
children:
498
+
$ref: '#/components/schemas/thing'
499
+
related:
500
+
type: integer
501
+
components:
502
+
schemas:
503
+
thing:
504
+
type: object
505
+
properties:
506
+
children:
507
+
type: object
508
+
properties:
509
+
children:
510
+
$ref: '#/components/schemas/thing'
511
+
related:
512
+
type: integer
513
+
related:
514
+
type: integer";
515
+
// Component schemas that are there due to cycles are still inlined because the items they reference may not exist in the components because they don't have cycles.
@@ -462,50 +578,61 @@ public void WriteInlineRecursiveSchema()
462
578
}
463
579
}
464
580
}
465
-
}
581
+
}
466
582
}
467
583
},
468
-
Components=newOpenApiComponents{
584
+
Components=newOpenApiComponents
585
+
{
469
586
Schemas={
470
-
["thing"]=thingSchema}
587
+
["thing"]=thingSchema}
471
588
}
472
589
};
473
-
590
+
returndoc;
591
+
}
592
+
593
+
[Fact]
594
+
publicvoidWriteInlineRecursiveSchemav2()
595
+
{
596
+
// Arrange
597
+
vardoc=CreateDocWithRecursiveSchemaReference();
598
+
474
599
varexpected=
475
-
@"openapi: 3.0.1
600
+
@"swagger: '2.0'
476
601
info:
477
602
title: Demo
478
603
version: 1.0.0
479
604
paths:
480
605
/:
481
606
get:
607
+
produces:
608
+
- application/json
482
609
responses:
483
610
'200':
484
611
description: OK
485
-
content:
486
-
application/json:
487
-
schema:
488
-
type: object
489
-
properties:
490
-
children:
491
-
$ref: '#/components/schemas/thing'
492
-
components:
493
-
schemas:
494
-
thing:
495
-
type: object
496
-
properties:
497
-
children:
498
-
type: object
499
-
properties:
500
-
children:
501
-
$ref: '#/components/schemas/thing'";
612
+
schema:
613
+
type: object
614
+
properties:
615
+
children:
616
+
$ref: '#/definitions/thing'
617
+
related:
618
+
type: integer
619
+
definitions:
620
+
thing:
621
+
type: object
622
+
properties:
623
+
children:
624
+
$ref: '#/definitions/thing'
625
+
related:
626
+
$ref: '#/definitions/related'
627
+
related:
628
+
type: integer";
502
629
// Component schemas that are there due to cycles are still inlined because the items they reference may not exist in the components because they don't have cycles.
0 commit comments