Skip to content

Commit b51e0ef

Browse files
authored
Merge pull request #237 from AthennaIO/develop
feat(openapi): also read openapi file to generate securities, tags, etc
2 parents 5ed45fe + 958a498 commit b51e0ef

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/http",
3-
"version": "5.49.0",
3+
"version": "5.50.0",
44
"description": "The Athenna Http server. Built on top of fastify.",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/kernels/HttpKernel.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Log } from '@athenna/logger'
1515
import { Config } from '@athenna/config'
1616
import { sep, isAbsolute, resolve } from 'node:path'
1717
import { Annotation, type ServiceMeta } from '@athenna/ioc'
18-
import { File, Path, Module, String } from '@athenna/common'
18+
import { File, Path, Module, String, Json } from '@athenna/common'
1919
import { HttpExceptionHandler } from '#src/handlers/HttpExceptionHandler'
2020

2121
export class HttpKernel {
@@ -83,10 +83,15 @@ export class HttpKernel {
8383
}
8484

8585
if (swaggerPlugin) {
86-
await Server.plugin(
87-
swaggerPlugin,
88-
Config.get('http.swagger.configurations')
89-
)
86+
const openapiConfig = Json.omit(Config.get('openapi', {}), ['paths'])
87+
const pluginConfig = Json.omit(Config.get('http.swagger.configurations', {}), ['swagger'])
88+
const swaggerConfig = Config.get('http.swagger.configurations.swagger', {})
89+
90+
await Server.plugin(swaggerPlugin, {
91+
...pluginConfig,
92+
...openapiConfig,
93+
...swaggerConfig
94+
})
9095
} else {
9196
debug(
9297
'Not able to register swagger plugin. Install @fastify/swagger package.'

0 commit comments

Comments
 (0)