@@ -298,6 +298,32 @@ public async Task ShouldResolveRelativeSubReference()
298298 Assert . Equal ( JsonSchemaType . String , seq2Property . Items . Items . Type ) ;
299299 }
300300 [ Fact ]
301+ public async Task ShouldResolveRelativeSubReferenceUsingParsingContext ( )
302+ {
303+ // Arrange
304+ var filePath = Path . Combine ( SampleFolderPath , "relativeSubschemaReference.json" ) ;
305+ using var fs = new FileStream ( filePath , FileMode . Open , FileAccess . Read ) ;
306+ var jsonNode = await JsonNode . ParseAsync ( fs ) ;
307+ var schemaJsonNode = jsonNode [ "components" ] ? [ "schemas" ] ? [ "Foo" ] ;
308+ Assert . NotNull ( schemaJsonNode ) ;
309+ var diagnostic = new OpenApiDiagnostic ( ) ;
310+ var parsingContext = new ParsingContext ( diagnostic ) ;
311+ parsingContext . StartObject ( "components" ) ;
312+ parsingContext . StartObject ( "schemas" ) ;
313+ parsingContext . StartObject ( "Foo" ) ;
314+ var document = new OpenApiDocument ( ) ;
315+
316+ // Act
317+ var fooComponentSchema = parsingContext . ParseFragment < OpenApiSchema > ( schemaJsonNode , OpenApiSpecVersion . OpenApi3_1 , document ) ;
318+ document . AddComponent ( "Foo" , fooComponentSchema ) ;
319+ var seq1Property = fooComponentSchema . Properties [ "seq1" ] ;
320+ Assert . NotNull ( seq1Property ) ;
321+ var seq2Property = fooComponentSchema . Properties [ "seq2" ] ;
322+ Assert . NotNull ( seq2Property ) ;
323+ Assert . Equal ( JsonSchemaType . Array , seq2Property . Items . Type ) ;
324+ Assert . Equal ( JsonSchemaType . String , seq2Property . Items . Items . Type ) ;
325+ }
326+ [ Fact ]
301327 public void ShouldFailToResolveRelativeSubReferenceFromTheObjectModel ( )
302328 {
303329 var document = new OpenApiDocument
0 commit comments