Skip to content

Commit d28d9bd

Browse files
committed
feat(openapi): allow config file options for openapi, validateResponses in test
1 parent ad86915 commit d28d9bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

config/test.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"logging": {
44
"level": "warn"
55
},
6+
"routing": {
7+
"openapi": {
8+
"validateResponses": true
9+
}
10+
},
611
"server": {
712
"port": 0
813
}

src/openapi.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,10 @@ export async function openApi<
114114
},
115115
};
116116

117-
return OpenApiValidator.middleware(_.defaultsDeep(defaultOptions, openApiOptions || {}));
117+
const { routing } = app.locals.config;
118+
const combinedOptions = {
119+
...(typeof routing.openapi === 'object' ? routing.openapi : {}),
120+
...openApiOptions,
121+
};
122+
return OpenApiValidator.middleware(_.defaultsDeep(defaultOptions, combinedOptions));
118123
}

0 commit comments

Comments
 (0)