File tree Expand file tree Collapse file tree 3 files changed +92
-4
lines changed
test/Microsoft.OpenApi.Tests Expand file tree Collapse file tree 3 files changed +92
-4
lines changed Original file line number Diff line number Diff line change 42
42
<DependentUpon >OpenApiCallbackReferenceTests.cs</DependentUpon >
43
43
</None >
44
44
45
+ <None Update =" Models\Samples\docWithDollarId.yaml" >
46
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
47
+ </None >
48
+
45
49
<None Update =" Models\Samples\docWithReusableWebhooks.yaml" >
46
50
<CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
47
51
</None >
48
52
49
53
<None Update =" PublicApi\PublicApi.approved.txt" CopyToOutputDirectory =" Always" />
50
54
</ItemGroup >
51
-
52
- <ItemGroup >
53
- <Folder Include =" Models\Samples\" />
54
- </ItemGroup >
55
55
</Project >
Original file line number Diff line number Diff line change @@ -1642,5 +1642,54 @@ public void SerializeV31DocumentWithRefsInWebhooksWorks()
1642
1642
var actual = stringWriter . ToString ( ) ;
1643
1643
actual . MakeLineBreaksEnvironmentNeutral ( ) . Should ( ) . BeEquivalentTo ( expected . MakeLineBreaksEnvironmentNeutral ( ) ) ;
1644
1644
}
1645
+
1646
+ [ Fact ]
1647
+ public void SerializeDocWithDollarIdInDollarRefSucceeds ( )
1648
+ {
1649
+ var expected = @"openapi: '3.1.0'
1650
+ info:
1651
+ title: Simple API
1652
+ version: 1.0.0
1653
+ paths:
1654
+ /box:
1655
+ get:
1656
+ responses:
1657
+ '200':
1658
+ description: OK
1659
+ content:
1660
+ application/json:
1661
+ schema:
1662
+ $ref: https://foo.bar/Box
1663
+ /circle:
1664
+ get:
1665
+ responses:
1666
+ '200':
1667
+ description: OK
1668
+ content:
1669
+ application/json:
1670
+ schema:
1671
+ $ref: https://foo.bar/Circle
1672
+ components:
1673
+ schemas:
1674
+ Box:
1675
+ $id: https://foo.bar/Box
1676
+ type: object
1677
+ properties:
1678
+ width:
1679
+ type: number
1680
+ height:
1681
+ type: number
1682
+ Circle:
1683
+ $id: https://foo.bar/Circle
1684
+ type: object
1685
+ properties:
1686
+ radius:
1687
+ type: number
1688
+ " ;
1689
+ var doc = OpenApiDocument . Load ( "Models/Samples/docWithDollarId.yaml" ) . OpenApiDocument ;
1690
+
1691
+ var actual = doc . SerializeAsYaml ( OpenApiSpecVersion . OpenApi3_1 ) ;
1692
+ actual . MakeLineBreaksEnvironmentNeutral ( ) . Should ( ) . BeEquivalentTo ( expected . MakeLineBreaksEnvironmentNeutral ( ) ) ;
1693
+ }
1645
1694
}
1646
1695
}
Original file line number Diff line number Diff line change
1
+ openapi : 3.1.0
2
+ info :
3
+ title : Simple API
4
+ version : 1.0.0
5
+ paths :
6
+ /box :
7
+ get :
8
+ responses :
9
+ ' 200 ' :
10
+ description : OK
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : https://foo.bar/Box
15
+ /circle :
16
+ get :
17
+ responses :
18
+ ' 200 ' :
19
+ description : OK
20
+ content :
21
+ application/json :
22
+ schema :
23
+ $ref : https://foo.bar/Circle
24
+ components :
25
+ schemas :
26
+ Box :
27
+ $id : https://foo.bar/Box
28
+ type : object
29
+ properties :
30
+ width :
31
+ type : number
32
+ height :
33
+ type : number
34
+ Circle :
35
+ $id : https://foo.bar/Circle
36
+ type : object
37
+ properties :
38
+ radius :
39
+ type : number
You can’t perform that action at this time.
0 commit comments