File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
test/Microsoft.OpenApi.Readers.Tests/V31Tests Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -434,6 +434,39 @@ public async Task ShouldResolveReferencesInSchemasFromSystemTextJson()
434434 var updatedTagsProperty = Assert . IsType < OpenApiSchemaReference > ( schema . Properties [ "tags" ] ) ;
435435 Assert . Equal ( absoluteReferenceId , updatedTagsProperty . Reference . ReferenceV3 ) ;
436436 Assert . Equal ( JsonSchemaType . Array | JsonSchemaType . Null , updatedTagsProperty . Type ) ;
437+ Assert . Equal ( JsonSchemaType . Object , updatedTagsProperty . Items . Type ) ;
438+
439+ var pathItem = new OpenApiPathItem
440+ {
441+ Operations = new Dictionary < HttpMethod , OpenApiOperation >
442+ {
443+ [ HttpMethod . Post ] = new OpenApiOperation
444+ {
445+ Responses = new OpenApiResponses
446+ {
447+ [ "200" ] = new OpenApiResponse
448+ {
449+ }
450+ } ,
451+ RequestBody = new OpenApiRequestBody
452+ {
453+ Content = new Dictionary < string , OpenApiMediaType >
454+ {
455+ [ "application/json" ] = new OpenApiMediaType
456+ {
457+ Schema = new OpenApiSchemaReference ( "#/components/schemas/Foo" , document )
458+ }
459+ }
460+ }
461+ }
462+ }
463+ } ;
464+ document . Paths . Add ( "/" , pathItem ) ;
465+
466+ var requestBodySchema = pathItem . Operations [ HttpMethod . Post ] . RequestBody . Content [ "application/json" ] . Schema ;
467+ Assert . NotNull ( requestBodySchema ) ;
468+ var requestBodyTagsProperty = Assert . IsType < OpenApiSchemaReference > ( requestBodySchema . Properties [ "tags" ] ) ;
469+ Assert . Equal ( JsonSchemaType . Object , requestBodyTagsProperty . Items . Type ) ;
437470 }
438471 }
439472}
You can’t perform that action at this time.
0 commit comments