File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
test/Microsoft.OpenApi.Readers.Tests/V3Tests Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
+ using System . Collections . Generic ;
4
5
using System . IO ;
5
6
using System . Linq ;
6
7
using FluentAssertions ;
@@ -200,6 +201,44 @@ public void ParseSimpleSchemaShouldSucceed()
200
201
}
201
202
}
202
203
204
+ [ Fact ]
205
+ public void ParsePathFragmentShouldSucceed ( )
206
+ {
207
+ var input = @"
208
+ summary: externally referenced path item
209
+ get:
210
+ responses:
211
+ '200':
212
+ description: Ok
213
+ " ;
214
+ var reader = new OpenApiStringReader ( ) ;
215
+ var diagnostic = new OpenApiDiagnostic ( ) ;
216
+
217
+ // Act
218
+ var openApiAny = reader . ReadFragment < OpenApiPathItem > ( input , OpenApiSpecVersion . OpenApi3_0 , out diagnostic ) ;
219
+
220
+ // Assert
221
+ diagnostic . ShouldBeEquivalentTo ( new OpenApiDiagnostic ( ) ) ;
222
+
223
+ openApiAny . ShouldBeEquivalentTo (
224
+ new OpenApiPathItem
225
+ {
226
+ Summary = "externally referenced path item" ,
227
+ Operations = new Dictionary < OperationType , OpenApiOperation >
228
+ {
229
+ [ OperationType . Get ] = new OpenApiOperation ( )
230
+ {
231
+ Responses = new OpenApiResponses
232
+ {
233
+ [ "200" ] = new OpenApiResponse {
234
+ Description = "Ok"
235
+ }
236
+ }
237
+ }
238
+ }
239
+ } ) ;
240
+ }
241
+
203
242
[ Fact ]
204
243
public void ParseDictionarySchemaShouldSucceed ( )
205
244
{
You can’t perform that action at this time.
0 commit comments