Coder Social home page Coder Social logo

Comments (7)

fehguy avatar fehguy commented on May 22, 2024

Looks like you are missing the responseClass. The error reporting is not good right now but the trace points here:

https://github.com/wordnik/swagger-codegen/blob/master/src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala#L139

from swagger-codegen.

bfreeman123 avatar bfreeman123 commented on May 22, 2024

Thanks for the response. That's what I figured. So I guess my question is as follows. Is there a reason why certain fields are required in swagger-codegen but are not required in swagger-ui? Again, I am simply feeding the output from grape-swagger into both, and it works in swagger-ui, but not in swagger-codegen.

from swagger-codegen.

fehguy avatar fehguy commented on May 22, 2024

Yes, the code generator is more strict with structure that the ui. Valid swagger specs are best, of course.

from swagger-codegen.

bfreeman123 avatar bfreeman123 commented on May 22, 2024

Thanks again for the explanation. I was able to get this to work by monkey-patching the swagger-grape gem to add the responseClass and errorResponses keys to Operations, and added the models key to the ApiListing (all of which are missing in the most recent version of the gem). I'll submit a pull request to the grape-swagger project that will implement these missing keys.

from swagger-codegen.

fehguy avatar fehguy commented on May 22, 2024

Thank you. And we will improve the validator messages as well as make a javascript version that's bundled with Swagger-ui.

from swagger-codegen.

berlincount avatar berlincount commented on May 22, 2024

bfreeman123, did you ever submit that pull request? I'm running into the same issues ..

from swagger-codegen.

bfreeman123 avatar bfreeman123 commented on May 22, 2024

No, I did not. While my patch got the code generator over that hurdle, it merely spit out un-usable code (at least for objective-c). As I recall, it wasn't mapping attributes correctly. I have since moved onto another project and abandoned the swagger codegen, but if you'd like to give it a try, you can simply add the responseClass key to the Operations hash on the grape-swagger gem.

If you look at https://github.com/tim-vandecasteele/grape-swagger/blob/master/lib/grape-swagger.rb starting on line 91, you essentially want to change:

operations = {
  :notes => notes,
  :summary => route.route_description || '',
  :nickname   => route.route_method + route.route_path.gsub(/[\/:\(\)\.]/,'-'),
  :httpMethod => route.route_method,
  :parameters => parse_header_params(route.route_headers) +
  parse_params(route.route_params, route.route_path, route.route_method)
}

to

operations = {
  :notes => notes,
  :summary => route.route_description || '',
  :nickname   => route.route_method + route.route_path.gsub(/[\/:\(\)\.]/,'-'),
  :httpMethod => route.route_method,
  :parameters => parse_header_params(route.route_headers) +
  parse_params(route.route_params, route.route_path, route.route_method),
  :responseClass => @@class_name
}

from swagger-codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.