File tree Expand file tree Collapse file tree 5 files changed +25
-26
lines changed
test/Microsoft.OpenApi.Readers.Tests Expand file tree Collapse file tree 5 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 1
- using System . Collections . Generic ;
1
+ using System . Collections . Generic ;
2
2
using System . Globalization ;
3
3
using System . IO ;
4
4
using FluentAssertions ;
@@ -69,8 +69,8 @@ public void ParseDocumentWithWebhooksShouldSucceed()
69
69
{
70
70
Schemas =
71
71
{
72
- [ "pet1 " ] = petSchema ,
73
- [ "newPet1 " ] = newPetSchema
72
+ [ "petSchema " ] = petSchema ,
73
+ [ "newPetSchema " ] = newPetSchema
74
74
}
75
75
} ;
76
76
Original file line number Diff line number Diff line change @@ -31,30 +31,30 @@ webhooks:
31
31
schema :
32
32
type : array
33
33
items :
34
- " $ref " : ' #/components/schemas/pet1 '
34
+ " $ref " : ' #/components/schemas/petSchema '
35
35
application/xml :
36
36
schema :
37
37
type : array
38
38
items :
39
- " $ref " : ' #/components/schemas/pet1 '
39
+ " $ref " : ' #/components/schemas/petSchema '
40
40
post :
41
41
requestBody :
42
42
description : Information about a new pet in the system
43
43
required : true
44
44
content :
45
45
' application/json ' :
46
46
schema :
47
- " $ref " : ' #/components/schemas/newPet1 '
47
+ " $ref " : ' #/components/schemas/newPetSchema '
48
48
responses :
49
49
" 200 " :
50
50
description : Return a 200 status to indicate that the data was received successfully
51
51
content :
52
52
application/json :
53
53
schema :
54
- $ref : ' #/components/schemas/pet1 '
54
+ $ref : ' #/components/schemas/petSchema '
55
55
components :
56
56
schemas :
57
- pet1 :
57
+ petSchema :
58
58
type : object
59
59
required :
60
60
- id
@@ -67,7 +67,7 @@ components:
67
67
type : string
68
68
tag :
69
69
type : string
70
- newPet1 :
70
+ newPetSchema :
71
71
type : object
72
72
required :
73
73
- name
Original file line number Diff line number Diff line change @@ -224,10 +224,9 @@ public void ParseBasicSchemaWithReferenceShouldSucceed()
224
224
}
225
225
} ) ;
226
226
227
- components . Should ( ) . BeEquivalentTo (
228
- new OpenApiComponents
229
- {
230
- Schemas =
227
+ var expectedComponents = new OpenApiComponents
228
+ {
229
+ Schemas =
231
230
{
232
231
[ "ErrorModel" ] = new JsonSchemaBuilder ( )
233
232
. Ref ( "#/components/schemas/ErrorModel" )
@@ -240,7 +239,7 @@ public void ParseBasicSchemaWithReferenceShouldSucceed()
240
239
. Ref ( "#/components/schemas/ExtendedErrorModel" )
241
240
. AllOf (
242
241
new JsonSchemaBuilder ( )
243
- . Ref ( "#/components/schemas/ExtendedErrorModel " )
242
+ . Ref ( "#/components/schemas/ErrorModel " )
244
243
. Type ( SchemaValueType . Object )
245
244
. Properties (
246
245
( "code" , new JsonSchemaBuilder ( ) . Type ( SchemaValueType . Integer ) . Minimum ( 100 ) . Maximum ( 600 ) ) ,
@@ -251,9 +250,9 @@ public void ParseBasicSchemaWithReferenceShouldSucceed()
251
250
. Required ( "rootCause" )
252
251
. Properties ( ( "rootCause" , new JsonSchemaBuilder ( ) . Type ( SchemaValueType . String ) ) ) )
253
252
}
254
- } ,
255
- options => options . Excluding ( m => m . Name == "HostDocument" )
256
- . IgnoringCyclicReferences ( ) ) ;
253
+ } ;
254
+
255
+ components . Should ( ) . BeEquivalentTo ( expectedComponents ) ;
257
256
}
258
257
259
258
[ Fact ]
Original file line number Diff line number Diff line change @@ -223,8 +223,8 @@ public void ParseStandardPetStoreDocumentShouldSucceed()
223
223
{
224
224
Schemas = new Dictionary < string , JsonSchema >
225
225
{
226
- [ "pet " ] = new JsonSchemaBuilder ( )
227
- . Ref ( "#/components/schemas/pet " )
226
+ [ "pet1 " ] = new JsonSchemaBuilder ( )
227
+ . Ref ( "#/components/schemas/pet1 " )
228
228
. Type ( SchemaValueType . Object )
229
229
. Required ( "id" , "name" )
230
230
. Properties (
@@ -249,7 +249,7 @@ public void ParseStandardPetStoreDocumentShouldSucceed()
249
249
}
250
250
} ;
251
251
252
- var petSchema = components . Schemas [ "pet " ] ;
252
+ var petSchema = components . Schemas [ "pet1 " ] ;
253
253
254
254
var newPetSchema = components . Schemas [ "newPet" ] ;
255
255
Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ paths:
42
42
schema :
43
43
type : array
44
44
items :
45
- " $ref " : ' #/components/schemas/pet '
45
+ " $ref " : ' #/components/schemas/pet1 '
46
46
application/xml :
47
47
schema :
48
48
type : array
49
49
items :
50
- " $ref " : ' #/components/schemas/pet '
50
+ " $ref " : ' #/components/schemas/pet1 '
51
51
52
52
' 4XX ' :
53
53
description : unexpected client error
77
77
content :
78
78
application/json :
79
79
schema :
80
- " $ref " : ' #/components/schemas/pet '
80
+ " $ref " : ' #/components/schemas/pet1 '
81
81
' 4XX ' :
82
82
description : unexpected client error
83
83
content :
@@ -108,10 +108,10 @@ paths:
108
108
content :
109
109
application/json :
110
110
schema :
111
- " $ref " : ' #/components/schemas/pet '
111
+ " $ref " : ' #/components/schemas/pet1 '
112
112
application/xml :
113
113
schema :
114
- " $ref " : ' #/components/schemas/pet '
114
+ " $ref " : ' #/components/schemas/pet1 '
115
115
' 4XX ' :
116
116
description : unexpected client error
117
117
content :
@@ -152,7 +152,7 @@ paths:
152
152
" $ref " : ' #/components/schemas/errorModel'
153
153
components :
154
154
schemas :
155
- pet :
155
+ pet1 :
156
156
type : object
157
157
required :
158
158
- id
You can’t perform that action at this time.
0 commit comments