Closed ksmithut closed 8 years ago
This is a good point. While we need to provide sensible defaults, we should provide capabilities to override. This will likely be config options passed to swaggerize()
.
The view configuration are also overrided to null since merge request #60, what's the motivation for that ? Swaggerize is a REST API tool but it's not uncommon for small services to manage APIs and UI in the same express app. In my opinion this behavior leads to confusion regarding to express documentation.
For a workaround, you can put app.use(...);
statements after you initialize the swaggerize-express middleware.
This will be addresses in https://github.com/krakenjs/swaggerize-express/pull/79.
See #80. Middleware should never configure express.
This is addressed in 4.0.5
.
It seems that swaggerize express is overriding some of my options that I set for my express app. I have set
json spaces
to 2, but it gets overridden here.Here is my example code:
Expected Behavior:
Api endpoints should have the correctly set
json spaces
option (for pretty printed json)Actual Behavior:
Api endpoints are not pretty printed because the setting is getting overridden.
Proposed Solution:
I know that
json spaces
isn't the only option that is being overriden, but I agree that the ones being overridden are sensible defaults for a majority of people. My only problem with it is that it is unexpected behavior based on my settings. I don't think that you can detect whether or not a setting was set on the user's end, but perhaps just leaving it up to the user to choose the settings would be best.