Skip to content

Commit

Permalink
fix(Tags): missing class decorator define (#1703)
Browse files Browse the repository at this point in the history
* test(Tags): apply tags decorator on controller class

* fix(Tags): missing class decorator definition

* test(Tags): adjust test cases to fit class decorator
  • Loading branch information
jackey8616 authored Oct 15, 2024
1 parent 4abc6ee commit 61b01cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/runtime/src/decorators/tags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function Tags(...values: string[]): MethodDecorator {
export function Tags(...values: string[]): ClassDecorator & MethodDecorator {
return () => {
return;
};
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/controllers/methodController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const TEST_SEC = {
const ATT_KEY9 = 'x-attKey9';

@Route('MethodTest')
@Tags('MethodTest')
export class MethodController extends Controller {
@Options('Options')
public async optionsMethod(): Promise<TestModel> {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/swagger/definitionsGeneration/metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Metadata generation', () => {
throw new Error('Method tags not defined!');
}

expect(method.tags).to.deep.equal(['Tag1', 'Tag2', 'Tag3']);
expect(method.tags).to.deep.equal(['Tag1', 'Tag2', 'Tag3', 'MethodTest']);
});

it('should generate multi response', () => {
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('Metadata generation', () => {
secondSec: ['permission:admin', 'permission:owner'],
});

expect(method.tags).to.deep.equal(['EnumTag1']);
expect(method.tags).to.deep.equal(['EnumTag1', 'MethodTest']);
});

it('should generate success response', () => {
Expand Down

0 comments on commit 61b01cf

Please sign in to comment.