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

Custom header option to swagger ui for all routes #189

Open
sumitsaha opened this issue Aug 15, 2019 · 1 comment
Open

Custom header option to swagger ui for all routes #189

sumitsaha opened this issue Aug 15, 2019 · 1 comment

Comments

@sumitsaha
Copy link

According to documentation it's possible to pass a header parameter to a specific route by passing a validate function to route config object like this:

server.route({
	method: 'PUT',
	path: '/generate',
	config: {
		validate: {
			headers: Joi.object({
				my_custom_header: Joi.string().required()
			}).options({
				allowUnknown: true
			})
		}
	}
});

But this would add a header option to swagger ui only for the route "/generate" like this image:

Screen Shot 2019-08-15 at 1 39 02 AM

I want to to add a common header option to all routes in swagger ui in my hapi server. Is it possible? Please note that I have already used the securityDefinitions to set a api_key. What I want is another common header values to swagger ui.

@JKHeadley
Copy link
Owner

Hi @sumitsaha . I'm not quite sure, but this sounds more like a hapi or hapi-swagger question rather than rest-hapi. Are you trying to do this with the routes generated by rest-hapi?

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

2 participants