Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
feat: Security schema added to Swagger definition (#9)
Browse files Browse the repository at this point in the history
* feat: Feature/swagger options (#4)

* feat: Initial release

* feat: Initial

* fix: Added `semantic-release-telegram-bot`

* feat: Added CI pipeline for `@relab/rejs-swagger`

* fix: Path typo fix `rejs-swagger`

* fix: Added `prepack` script

* fix: Fixed pipeline names

* fix: Adjustments to NPM package content

* fix: Fixed pipeline names

* fix: Pipelines added to trigger condition

* docs: Added `README.md`

* feat: Swagger options added

* fix(deps): Dependencies fix

* fix(deps): Dependencies fix

* fix(deps): Dependencies fix (#5)

* feat: Swagger options added

* fix(deps): Dependencies fix

* fix(deps): Dependencies fix

* fix(deps): Dependencies fix

* fix(deps): Dependencies fix

* fix: Description added

* fix(deps): Remove peer dependency to @relab/rejs (#6)

* fix(deps): Remove peer dependency to @relab/rejs

* fix(devops): Trigger build on package-lock.json change

* feat: Registry configure

* feat: Security support
  • Loading branch information
sergeyzwezdin authored Apr 4, 2024
1 parent 99996cf commit b2e5ddb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/rejs-swagger/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const register = (
if (isRoute(item)) {
const { metadata } = item

const { response: responseDescription, ...description } = metadata.metadata ?? {}
const { response: responseDescription, security, ...description } = metadata.metadata ?? {}

const responses: Record<number, ResponseConfig> = {}
const mimeTypes = Array.from(new Set([formatter.default.mimeType, ...Object.values(formatter.formatters).map(({ mimeType }) => mimeType)]))
Expand Down Expand Up @@ -64,6 +64,7 @@ export const register = (
: undefined,
query: metadata.schema.query,
},
security: security?.reduce<Record<string, string[]>[]>((result, current) => [...result, { [current]: [] }], []),

responses,
})
Expand Down
2 changes: 2 additions & 0 deletions packages/rejs/src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const route = <
response?: string
deprecated?: boolean
tags?: string[]
security?: string[]
}
}): ((handler: (request: HandlerParameter, context: RequestContext) => HandlerResult) => {
metadata: {
Expand All @@ -78,6 +79,7 @@ export const route = <
response?: string
deprecated?: boolean
tags?: string[]
security?: string[]
}
}
setup: RouteSetupHandler
Expand Down
1 change: 1 addition & 0 deletions packages/rejs/src/types/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type Route<
response?: string
deprecated?: boolean
tags?: string[]
security?: string[]
}
}
setup: RouteSetupHandler
Expand Down

0 comments on commit b2e5ddb

Please sign in to comment.