Skip to content

Commit

Permalink
fix: fall back to default configuration options in subtree resolver c…
Browse files Browse the repository at this point in the history
…alls (via #5063)
  • Loading branch information
shockey authored Dec 7, 2018
1 parent 2669b26 commit b84a0fe
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/core/plugins/swagger-js/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import Swagger from "swagger-client"

module.exports = function({ configs }) {
module.exports = function({ configs, getConfigs }) {
return {
fn: {
fetch: Swagger.makeHttp(configs.preFetch, configs.postFetch),
buildRequest: Swagger.buildRequest,
execute: Swagger.execute,
resolve: Swagger.resolve,
resolveSubtree: Swagger.resolveSubtree,
resolveSubtree: (obj, path, opts, ...rest) => {
if(opts === undefined) {
const freshConfigs = getConfigs()
opts = {
modelPropertyMacro: freshConfigs.modelPropertyMacro,
parameterMacro: freshConfigs.parameterMacro,
requestInterceptor: freshConfigs.requestInterceptor,
responseInterceptor: freshConfigs.responseInterceptor
}
}

return Swagger.resolveSubtree(obj, path, opts, ...rest)
},
serializeRes: Swagger.serializeRes,
opId: Swagger.helpers.opId
}
Expand Down

0 comments on commit b84a0fe

Please sign in to comment.