kevindew / openapi3_parser

Open API 3 Parser/Validator for Ruby
MIT License
90 stars 12 forks source link

Unable to validate/parse document CGI (NameError) #2

Closed mikebell closed 6 years ago

mikebell commented 6 years ago

I'm trying to parse through https://raw.githubusercontent.com/alphagov/content-store/deployed-to-production/openapi.yaml

When I load the document then run it through valid? I get the following:

/home/digital/.rvm/gems/ruby-2.5.1/gems/openapi3_parser-0.3.0/lib/openapi3_parser/source/reference.rb:51:in `block in json_pointer': uninitialized constant Openapi3Parser::Source::Reference::CGI (NameError)

Any help would be greatly appreciated.

kevindew commented 6 years ago

Hello :wave:

Hmm I'd guess that's occurring because we need to require the CGI module which I thought was part of ruby stdlib. Either that or it might need namespace setting as ::CGI.

I've not been able to replicate this locally, but googling it looks like this will fix it: https://github.com/kevindew/openapi3_parser/commit/8673b82193d2062ebc57122967ee6cda4f2f4f44

Would you mind trying that and confirming if that fixes? if so I'll merge it and push a new release out.

mikebell commented 6 years ago

Great, this fixes the issue thanks for the update.

kevindew commented 6 years ago

Super, there must be something in my codebase that already requires CGI then - how annoying.

I've just pushed a new release out with the change https://github.com/kevindew/openapi3_parser/releases/tag/v0.4.0 which you should be able to get from rubygems shortly.