You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var stream = new HttpClient().GetStreamAsync("https://petstore.swagger.io/v2/swagger.json").Result;
var inputDocument = new OpenApiStreamReader().Read(stream, out var diagnostic);
Debug.Assert(diagnostic.SpecificationVersion == OpenApiSpecVersion.OpenApi2_0);
var schema = inputDocument.Paths["/pet/{petId}"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema;
schema ends up null, whereas it should contain Pet.
The problem comes because of the produces with two media types. If you run the petstore OpenAPI through the workbench tool you get the following V3 output.
The schema is preserved for the first content type but lost for the second. I suspect this is a regression related to other changes around maintaining state whilst translating V2 into V3.
Hello, i think i'm running into a similar scenario the response schema reference is empty.
The bug is introduced in the package v1.1.2. I rolled back to v1.1.1 the schema is now read correctly.
Activity
darrelmiller commentedon Mar 13, 2019
Hey Sebastien Bacquet (@sbacquet) Good catch.
The problem comes because of the produces with two media types. If you run the petstore OpenAPI through the workbench tool you get the following V3 output.
The schema is preserved for the first content type but lost for the second. I suspect this is a regression related to other changes around maintaining state whilst translating V2 into V3.
I will investigate.
sbacquet commentedon Mar 13, 2019
Hello Darrel,
Thanks a lot for investigating.
May I suggest to add a unit test to cover this case ? ;)
Thanks again!
huaxing-yuan commentedon Mar 13, 2019
Hello, i think i'm running into a similar scenario the response schema reference is empty.
The bug is introduced in the package v1.1.2. I rolled back to v1.1.1 the schema is now read correctly.
This is part of my swagger v2 document
darrelmiller commentedon Mar 13, 2019
Huaxing YUAN (@huaxing-yuan) Thanks for the additional info, I suspected it was a regression. And yes Sebastien Bacquet (@sbacquet) I'll make sure that our test cases are updated to account for this.
VitaliyKurokhtin commentedon Apr 10, 2019
Should be resolved by #398
darrelmiller commentedon Apr 27, 2019
This fix should be available in 1.1.3
sbacquet commentedon Apr 29, 2019
I confirm it's fixed, thank you !