Skip to content

Commit

Permalink
refactor: Refactor swagger module (#3756)
Browse files Browse the repository at this point in the history
* chore: update

* test: add more case

* fix: lint

* test: add more case

* chore: add more case

* chore: add more case

* chore: add more case

* chore: add more case
  • Loading branch information
czy88840616 committed May 6, 2024
1 parent 39de1bf commit fdc1f9a
Show file tree
Hide file tree
Showing 10 changed files with 5,452 additions and 819 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@types/node": "18.19.31",
"@vercel/ncc": "0.38.1",
"autocannon": "7.15.0",
"@babel/plugin-proposal-decorators": "7.24.1",
"jest": "29.7.0",
"lerna": "7.4.2",
"lerna-changelog": "2.2.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/swagger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"jest": "node --require=ts-node/register ../../node_modules/jest/bin/jest.js",
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit"
"test": "../../node_modules/.bin/jest --runInBand",
"cov": "../../node_modules/.bin/jest --runInBand --coverage --forceExit"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/swagger/src/decorators/api-header.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DECORATORS } from '../constants';
import { SwaggerEnumType, ParameterObject, Type } from '../interfaces';
import { getEnumType, getEnumValues } from '../common/enum.utils';
import { createMixedDecorator, createParamDecorator } from './helpers';
import { createMixedDecorator } from './helpers';

export interface ApiHeaderOptions extends Omit<ParameterObject, 'in'> {
enum?: SwaggerEnumType;
Expand Down Expand Up @@ -37,7 +37,7 @@ export function ApiHeader(options: ApiHeaderOptions): any {
descriptor?: TypedPropertyDescriptor<any>
): any => {
if (descriptor) {
return createParamDecorator(param, defaultHeaderOptions as any)(
return createMixedDecorator(DECORATORS.API_HEADERS, param)(
target,
key,
descriptor
Expand Down

0 comments on commit fdc1f9a

Please sign in to comment.