z0mt3c / hapi-swaggered

Yet another hapi plugin providing swagger compliant API specifications based on routes and joi schemas to be used with swagger-ui.
MIT License
82 stars 38 forks source link

Support response messages & codes #1

Closed z0mt3c closed 9 years ago

z0mt3c commented 10 years ago

May through handler.config.plugins['hapi-swaggered]? (https://github.com/hapijs/hapi/blob/master/docs/Reference.md#route-options)

"plugins - plugin-specific configuration. Provides a place to pass route-level plugin configuration. The plugins is an object where each key is a plugin name and the value is the state."

calmdev commented 9 years ago

@z0mt3c I just swapped to hapi-swaggered and then found this issue.

Did you decide not to implement this? What you proposed is how hapi-swagger handles it:

{
    description: 'Get users.',
    notes: 'Returns all users.',
    tags: ['api'],
    plugins: {
        'hapi-swagger': {
            responseMessages: [
                { code: 401, message: 'Unauthorized' }
            ]
        }
    },
    handler: function (request, reply) {
        ....
    }
}
calmdev commented 9 years ago

Looks like you're working on it in #7 @ 891aa89c7f7ee7772fb4a62d7d5836df014d7ce8 :+1: