Skip to content

Commit 3c037cf

Browse files
authored
Merge pull request #695 from samchon/features/ignore
Close #693 - `@ignore` comment tag.
2 parents 52dff3e + 2040256 commit 3c037cf

33 files changed

+1520
-15
lines changed

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/core",
3-
"version": "2.3.11",
3+
"version": "2.3.12",
44
"description": "Super-fast validation decorators of NestJS",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -34,7 +34,7 @@
3434
},
3535
"homepage": "https://nestia.io",
3636
"dependencies": {
37-
"@nestia/fetcher": "^2.3.11",
37+
"@nestia/fetcher": "^2.3.12",
3838
"@nestjs/common": ">=7.0.1",
3939
"@nestjs/core": ">=7.0.1",
4040
"@nestjs/platform-express": ">=7.0.1",
@@ -47,7 +47,7 @@
4747
"typia": "^5.2.6"
4848
},
4949
"peerDependencies": {
50-
"@nestia/fetcher": ">=2.3.11",
50+
"@nestia/fetcher": ">=2.3.12",
5151
"@nestjs/common": ">=7.0.1",
5252
"@nestjs/core": ">=7.0.1",
5353
"@nestjs/platform-express": ">=7.0.1",

packages/fetcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/fetcher",
3-
"version": "2.3.11",
3+
"version": "2.3.12",
44
"description": "Fetcher library of Nestia SDK",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/sdk/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/sdk",
3-
"version": "2.3.11",
3+
"version": "2.3.12",
44
"description": "Nestia SDK and Swagger generator",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -35,7 +35,7 @@
3535
},
3636
"homepage": "https://nestia.io",
3737
"dependencies": {
38-
"@nestia/fetcher": "^2.3.11",
38+
"@nestia/fetcher": "^2.3.12",
3939
"cli": "^1.0.1",
4040
"get-function-location": "^2.0.0",
4141
"glob": "^7.2.0",
@@ -47,7 +47,7 @@
4747
"typia": "^5.2.6"
4848
},
4949
"peerDependencies": {
50-
"@nestia/fetcher": ">=2.3.11",
50+
"@nestia/fetcher": ">=2.3.12",
5151
"@nestjs/common": ">=7.0.1",
5252
"@nestjs/core": ">=7.0.1",
5353
"reflect-metadata": ">=0.1.12",

packages/sdk/src/analyses/ControllerAnalyzer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export namespace ControllerAnalyzer {
115115
return [];
116116
}
117117

118+
// SKIP @IGNORE TAG
119+
const jsDocTags = signature.getJsDocTags();
120+
if (jsDocTags.some((tag) => tag.name === "ignore")) return [];
121+
118122
// EXPLORE CHILDREN TYPES
119123
const importDict: ImportAnalyzer.Dictionary = new HashMap();
120124
const parameters: Array<IRoute.IParameter | null> =
@@ -168,8 +172,7 @@ export namespace ControllerAnalyzer {
168172
.toJSON()
169173
.map((pair) => [pair.first, pair.second.toJSON()]);
170174

171-
// PARSE COMMENT TAGS
172-
const jsDocTags = signature.getJsDocTags();
175+
// CONSIDER SECURITY TAGS
173176
const security: Record<string, string[]>[] = SecurityAnalyzer.merge(
174177
...controller.security,
175178
...func.security,

test/features/ignore/nestia.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { INestiaConfig } from "@nestia/sdk";
2+
3+
export const NESTIA_CONFIG: INestiaConfig = {
4+
input: ["src/controllers"],
5+
output: "src/api",
6+
swagger: {
7+
output: "swagger.json",
8+
security: {
9+
bearer: {
10+
type: "apiKey",
11+
},
12+
},
13+
},
14+
};
15+
export default NESTIA_CONFIG;

test/features/ignore/src/Backend.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import core from "@nestia/core";
2+
import { INestApplication } from "@nestjs/common";
3+
import { NestFactory } from "@nestjs/core";
4+
import { Singleton } from "tstl";
5+
6+
export class Backend {
7+
public readonly application: Singleton<Promise<INestApplication>> =
8+
new Singleton(async () =>
9+
NestFactory.create(
10+
await core.EncryptedModule.dynamic(__dirname + "/controllers", {
11+
key: "A".repeat(32),
12+
iv: "B".repeat(16),
13+
}),
14+
{ logger: false },
15+
),
16+
);
17+
18+
public async open(): Promise<void> {
19+
return (await this.application.get()).listen(37_000);
20+
}
21+
22+
public async close(): Promise<void> {
23+
return (await this.application.get()).close();
24+
}
25+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { HttpError } from "@nestia/fetcher";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type { IConnection } from "@nestia/fetcher";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type { Primitive } from "@nestia/fetcher";
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/**
2+
* @packageDocumentation
3+
* @module api.functional.bbs.articles
4+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
5+
*/
6+
//================================================================
7+
import type { IConnection, Primitive } from "@nestia/fetcher";
8+
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";
9+
import type { Format } from "typia/lib/tags/Format";
10+
11+
import type { IBbsArticle } from "../../../structures/IBbsArticle";
12+
13+
/**
14+
* Store an article.
15+
*
16+
* @param input Content to store
17+
* @returns Newly archived article
18+
* @deprecated
19+
*
20+
* @controller BbsArticlesController.store
21+
* @path POST /bbs/articles
22+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
23+
*/
24+
export async function store(
25+
connection: IConnection,
26+
input: store.Input,
27+
): Promise<store.Output> {
28+
return PlainFetcher.fetch(
29+
{
30+
...connection,
31+
headers: {
32+
...(connection.headers ?? {}),
33+
"Content-Type": "application/json",
34+
},
35+
},
36+
{
37+
...store.METADATA,
38+
path: store.path(),
39+
} as const,
40+
input,
41+
);
42+
}
43+
export namespace store {
44+
export type Input = Primitive<IBbsArticle.IStore>;
45+
export type Output = Primitive<IBbsArticle>;
46+
47+
export const METADATA = {
48+
method: "POST",
49+
path: "/bbs/articles",
50+
request: {
51+
type: "application/json",
52+
encrypted: false
53+
},
54+
response: {
55+
type: "application/json",
56+
encrypted: false,
57+
},
58+
status: null,
59+
} as const;
60+
61+
export const path = (): string => {
62+
return `/bbs/articles`;
63+
}
64+
}
65+
66+
/**
67+
*
68+
* @internal
69+
*
70+
* @controller BbsArticlesController.update
71+
* @path PUT /bbs/articles/:id
72+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
73+
*/
74+
export async function update(
75+
connection: IConnection,
76+
id: string & Format<"uuid">,
77+
input: update.Input,
78+
): Promise<void> {
79+
return PlainFetcher.fetch(
80+
{
81+
...connection,
82+
headers: {
83+
...(connection.headers ?? {}),
84+
"Content-Type": "application/json",
85+
},
86+
},
87+
{
88+
...update.METADATA,
89+
path: update.path(id),
90+
} as const,
91+
input,
92+
);
93+
}
94+
export namespace update {
95+
export type Input = Primitive<Partial<IBbsArticle.IStore>>;
96+
97+
export const METADATA = {
98+
method: "PUT",
99+
path: "/bbs/articles/:id",
100+
request: {
101+
type: "application/json",
102+
encrypted: false
103+
},
104+
response: {
105+
type: "application/json",
106+
encrypted: false,
107+
},
108+
status: null,
109+
} as const;
110+
111+
export const path = (id: string & Format<"uuid">): string => {
112+
return `/bbs/articles/${encodeURIComponent(id ?? "null")}`;
113+
}
114+
}

0 commit comments

Comments
 (0)