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

Disable swagger badge when route contains localhost #16

Closed grabbou closed 9 years ago

grabbou commented 9 years ago

Useful, otherwise it shows "error" suggesting there's a mistake in the generated API docs.

z0mt3c commented 9 years ago

Good point - but this issue belongs to hapi-swaggered-ui. hapi-swaggered does not have any control about that. (But one of them could offer a built-in validator.)

I opened an issue z0mt3c/hapi-swaggered-ui#5 to add the missing configuration options. But i'm not sure if should really toggle it based on "localhost" or the validation should just be off as default. I guess most apis are running private and not on localhost (except during development). What do you think?

grabbou commented 9 years ago

Ah, true. That's UI stuff :)

Well, maybe we should check if NODE_ENV === production and if so, display the validator? Obviously, user should be able to explicitly overload that config by passing enableValidation boolean or something similar. How that sounds?

z0mt3c commented 9 years ago

Seem the current swagger-ui doesnt even contain a default validation url anymore. Follow up in z0mt3c/hapi-swaggered-ui