Coder Social home page Coder Social logo

Comments (3)

glennjones avatar glennjones commented on May 24, 2024

I am not going to be able to look at this for next three weeks as just about to leave for hols. If you want track down the issue and create a PR great, otherwise I pick it up on my return.

from hapi-swagger.

grabbou avatar grabbou commented on May 24, 2024

Also - when multiple routes are defined like so:

  • events/{id} GET
  • events/{id} POST
  • events/{id} DELETE
    And no className is set and the automatic one is generated (eventsid_response) and if responses are different (for example DELETE response returns affected rows), they are mixed up and all of them are the same as the first one ever defined (in this case - GET response schema).

Quick fix can be done by modifying this line:

var responseProperty = internals.validatorToProperty(responseClassName || op.nickname + '_response',

to

var responseProperty = internals.validatorToProperty(responseClassName || op.nickname + '_' + route.method + '_response',

I guess it is because Swagger returns all of models under "models" property, so if the name is the same, they overwrite themselves.

So - the results are:
eventsid_GET_response
eventsid_POST_response
eventsid_DELETE_response

Also I think that "name generation" should be done inside __getClassName, instead of doing || conditional in method args.

Can do PR for this and above as well if you want.

from hapi-swagger.

glennjones avatar glennjones commented on May 24, 2024

Hi Mike, sorry taken I while to get back to you

I believe I have fixed the two use case issues you where having. Can you try out v0.6.3 and make sure it works the way you expected.

from hapi-swagger.

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.