Skip to content

Commit 61b01cf

Browse files
authored
fix(Tags): missing class decorator define (#1703)
* test(Tags): apply tags decorator on controller class * fix(Tags): missing class decorator definition * test(Tags): adjust test cases to fit class decorator
1 parent 4abc6ee commit 61b01cf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

packages/runtime/src/decorators/tags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function Tags(...values: string[]): MethodDecorator {
1+
export function Tags(...values: string[]): ClassDecorator & MethodDecorator {
22
return () => {
33
return;
44
};

tests/fixtures/controllers/methodController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const TEST_SEC = {
3030
const ATT_KEY9 = 'x-attKey9';
3131

3232
@Route('MethodTest')
33+
@Tags('MethodTest')
3334
export class MethodController extends Controller {
3435
@Options('Options')
3536
public async optionsMethod(): Promise<TestModel> {

tests/unit/swagger/definitionsGeneration/metadata.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe('Metadata generation', () => {
155155
throw new Error('Method tags not defined!');
156156
}
157157

158-
expect(method.tags).to.deep.equal(['Tag1', 'Tag2', 'Tag3']);
158+
expect(method.tags).to.deep.equal(['Tag1', 'Tag2', 'Tag3', 'MethodTest']);
159159
});
160160

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

230-
expect(method.tags).to.deep.equal(['EnumTag1']);
230+
expect(method.tags).to.deep.equal(['EnumTag1', 'MethodTest']);
231231
});
232232

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

0 commit comments

Comments
 (0)