civisanalytics / swagger-diff

Utility for comparing two Swagger specifications.
BSD 3-Clause "New" or "Revised" License
265 stars 32 forks source link

Check for nil before dereferencing the schema field of a Parameter #7

Closed davidvc closed 8 years ago

davidvc commented 8 years ago

I caught this issue while testing swagger-diff with some of my endpoints. Checking for nil seems to solve the problem.

jeffreyc commented 8 years ago

Thank you for your PR! I think this is a subset of the problem you reported in #6, which means it should be fixed by #8.

Thanks to your report in #6, we found a bug parsing "header" and "formData" parameters. schema is required for "body" parameters, so the conditional shouldn't be needed. But prior to #8, "header" and "formData" parameters, which don't have a schema, were hitting this line, which would not have worked.

I'll update this PR when 1.0.3 is released (probably this afternoon) so you can grab the latest version and verify that it addresses this issue for you.

davidvc commented 8 years ago

Great, thanks! I have hit a couple more bugs which I'll try to track down. Would it help to send you the JSON causing the errors?

On Wed, Nov 4, 2015 at 10:34 AM jeffreyc notifications@github.com wrote:

Thank you for your PR! I think this is a subset of the problem you reported in #6 https://github.com/civisanalytics/swagger-diff/issues/6, which means it should be fixed by #8 https://github.com/civisanalytics/swagger-diff/pull/8.

Thanks to your report in #6 https://github.com/civisanalytics/swagger-diff/issues/6, we found a bug parsing "header" and "formData" parameters. schema is required for "body" parameters, so the conditional shouldn't be needed. But prior to #8 https://github.com/civisanalytics/swagger-diff/pull/8, "header" and "formData" parameters, which don't have a schema, were hitting this line, which would not have worked.

I'll update this PR when 1.0.3 is released (probably this afternoon) so you can grab the latest version and verify that it addresses this issue for you.

— Reply to this email directly or view it on GitHub https://github.com/civisanalytics/swagger-diff/pull/7#issuecomment-153822566 .

jeffreyc commented 8 years ago

If your bugs are related to header or formData parameters, they may be fixed in 1.0.3, but if not, we welcome issues (and pull requests), and would definitely appreciate sample Swagger that triggers the bug. Thanks!

jeffreyc commented 8 years ago

I just released 1.0.3. Hopefully that will address the bugs you've encountered, but if not, please file issues or create pull requests. Thanks!