garethr / puppet-swagger-generator

Generate Puppet types and providers from Swagger specifications
MIT License
11 stars 7 forks source link

Kubernetes generation failed #6

Closed nelsonjr closed 8 years ago

nelsonjr commented 8 years ago

Attempting to generate the Kubernetes module, without any changes, fail.

kubernetes @ commit 1232e32ec387c2511a7a01bec1f393e53032d7f9 ruby @ ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] gem @ puppet-swagger-generator (0.1.0)

Running the generator code from HEAD produces the same behavior. generator @ commit a3106f99dbca5d2eab353ee04912a39d6b21ba74

$ puppet-swagger-generator --namespace kubernetes --schema v1.json 
(erb):48:in `block in generate': undefined method `gsub' for nil:NilClass (NoMethodError)
        from (erb):45:in `each'
        from (erb):45:in `generate'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/2.3.0/erb.rb:864:in `eval'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/2.3.0/erb.rb:864:in `result'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/lib/puppet-swagger-generator.rb:57:in `generate'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/lib/puppet-swagger-generator.rb:39:in `generate_type'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/lib/puppet-swagger-generator.rb:85:in `block in execute'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/lib/puppet-swagger-generator.rb:82:in `each'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/lib/puppet-swagger-generator.rb:82:in `execute'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:63:in `run'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:132:in `run'
        from /home/nelsona/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puppet-swagger-generator-0.1.0/bin/puppet-swagger-generator:5:in `<top (required)>'
        from /home/nelsona/.rbenv/versions/2.3.1/bin/puppet-swagger-generator:23:in `load'
        from /home/nelsona/.rbenv/versions/2.3.1/bin/puppet-swagger-generator:23:in `<main>'

I put some debugging in the code and it is crashing when going through module "versioned.Event".

garethr commented 8 years ago

I've just recreated this and pushed a change to work around it. Or rather ignore the specific error - https://github.com/garethr/puppet-swagger-generator/commit/6b3ef74d36263cdd4129a4bfac03423072111d5f.

This lets it run and prints errors with resources it can't process, but it will run without the error mentioned here.