Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isRequired: false doesn't work with scope: 'path' in Swagger UI #12

Open
metasection opened this issue Oct 29, 2014 · 1 comment
Open

Comments

@metasection
Copy link

We are using scope: 'path" because we like the way the URL's are formatted. Very "Resty"!

When the fields are set to scope: 'query' our GET works fine with Swagger UI.

When the optional fields (isRequired: false) are set to scope: 'path' a Javascript error occurs in the Swagger UI. Please see the following screen shot.

"filter is a required path param"

screen shot 2014-10-29 at 9 38 17 am

Here is a screen shot of the Swagger UI showing the fields.

screen shot 2014-10-29 at 9 37 50 am

Here is the definition of my route.

server.get({url: '/billing/event/:limit/:page/:sort',
  swagger: {
    summary: 'Get the billing events',
    notes: '',
    nickname: 'getBillingEvents'
  },
  validation: {
    limit: { isRequired: true, description: 'Row return limit', swaggerType: 'integer', scope: 'path' },
    page: { isRequired: true, description: 'Page number', swaggerType: 'integer', scope: 'path' },
    sort: { isRequired: true, description: 'Sort by field name', swaggerType: 'string', scope: 'path' },
    filter: { isRequired: false, description: 'Customer tag filter', swaggerType: 'string', scope: 'path' }
  }}, require('./api/billing_event').getBillingEvents);

We have played around with adding the "/:filter" to the url and changing various options in the validators.

I took a peak at the module source code. There is a lot of good code in there. My wild guess is that _pushPathParameters may need a fix. It doesn't take into consideration the isRequired option. Just a guess.

@metasection
Copy link
Author

Just retest this. Still broken. Guidance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant