Open HaywardsHeathen opened 6 years ago
Thanks. Will investigate.
Sorry for the slow response. I believe the issue is resolved in this project https://github.com/Microsoft/OpenAPI.NET A nuget will be published soon.
Thanks for following up 👍 I will take a look at https://github.com/Microsoft/OpenAPI.NET
Parsing a Swagger 2.0 file which contains tags in an operation field results in the following exception being thrown. Message: System.ArgumentNullException : Value cannot be null. Parameter name: stream.
I created a new test to demonstrate the problem. It pulls in the swagger petstore example yaml file.
`V2ParsingTests using Xunit; using Tavis.OpenApi;
namespace OpenApiTests.V2Tests { public class V2ParsingTests { [Theory, InlineData("OpenApiTests.V2Tests.V2Samples.petstore.yaml", true)] public void Tests(string filename, bool expectedResult) { var v2stream = this.GetType().Assembly.GetManifestResourceStream(filename); var openApiDoc2 = OpenApiParser.Parse(v2stream).OpenApiDocument; var result = openApiDoc2.Version == "2.0"; Assert.True(result == expectedResult); }
} ` This is the resultant stack trace when the test is executed
Test Name: OpenApiTests.V2Tests.V2ParsingTests.Tests(filename: "OpenApiTests.V2Tests.V2Samples.petstore.yaml", expectedResult: True) Test FullName: OpenApiTests.V2Tests.V2ParsingTests.Tests Test Source: C:\Users\Rich\source\repos\Tavis.OpenApi\src\OpenApiTests\V2Tests\V2ParsingTests.cs : line 11 Test Outcome: Failed Test Duration: 0:00:00.083
Result StackTrace:
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen) at System.IO.StreamReader..ctor(Stream stream) at Tavis.OpenApi.OpenApiParser.Parse(Stream stream) at OpenApiTests.V2Tests.V2ParsingTests.Tests(String filename, Boolean expectedResult) in C:\Users\Rich\source\repos\Tavis.OpenApi\src\OpenApiTests\V2Tests\V2ParsingTests.cs:line 13 Result Message: System.ArgumentNullException : Value cannot be null. Parameter name: stream