Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #693 - @ignore comment tag. #695

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "2.3.11",
"version": "2.3.12",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.3.11",
"@nestia/fetcher": "^2.3.12",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand All @@ -47,7 +47,7 @@
"typia": "^5.2.6"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.3.11",
"@nestia/fetcher": ">=2.3.12",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "2.3.11",
"version": "2.3.12",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "2.3.11",
"version": "2.3.12",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.3.11",
"@nestia/fetcher": "^2.3.12",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
Expand All @@ -47,7 +47,7 @@
"typia": "^5.2.6"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.3.11",
"@nestia/fetcher": ">=2.3.12",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
Expand Down
7 changes: 5 additions & 2 deletions packages/sdk/src/analyses/ControllerAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export namespace ControllerAnalyzer {
return [];
}

// SKIP @IGNORE TAG
const jsDocTags = signature.getJsDocTags();
if (jsDocTags.some((tag) => tag.name === "ignore")) return [];

// EXPLORE CHILDREN TYPES
const importDict: ImportAnalyzer.Dictionary = new HashMap();
const parameters: Array<IRoute.IParameter | null> =
Expand Down Expand Up @@ -168,8 +172,7 @@ export namespace ControllerAnalyzer {
.toJSON()
.map((pair) => [pair.first, pair.second.toJSON()]);

// PARSE COMMENT TAGS
const jsDocTags = signature.getJsDocTags();
// CONSIDER SECURITY TAGS
const security: Record<string, string[]>[] = SecurityAnalyzer.merge(
...controller.security,
...func.security,
Expand Down
15 changes: 15 additions & 0 deletions test/features/ignore/nestia.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { INestiaConfig } from "@nestia/sdk";

export const NESTIA_CONFIG: INestiaConfig = {
input: ["src/controllers"],
output: "src/api",
swagger: {
output: "swagger.json",
security: {
bearer: {
type: "apiKey",
},
},
},
};
export default NESTIA_CONFIG;
25 changes: 25 additions & 0 deletions test/features/ignore/src/Backend.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import core from "@nestia/core";
import { INestApplication } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import { Singleton } from "tstl";

export class Backend {
public readonly application: Singleton<Promise<INestApplication>> =
new Singleton(async () =>
NestFactory.create(
await core.EncryptedModule.dynamic(__dirname + "/controllers", {
key: "A".repeat(32),
iv: "B".repeat(16),
}),
{ logger: false },
),
);

public async open(): Promise<void> {
return (await this.application.get()).listen(37_000);
}

public async close(): Promise<void> {
return (await this.application.get()).close();
}
}
1 change: 1 addition & 0 deletions test/features/ignore/src/api/HttpError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { HttpError } from "@nestia/fetcher";
1 change: 1 addition & 0 deletions test/features/ignore/src/api/IConnection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { IConnection } from "@nestia/fetcher";
1 change: 1 addition & 0 deletions test/features/ignore/src/api/Primitive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { Primitive } from "@nestia/fetcher";
114 changes: 114 additions & 0 deletions test/features/ignore/src/api/functional/bbs/articles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* @packageDocumentation
* @module api.functional.bbs.articles
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
import type { IConnection, Primitive } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";
import type { Format } from "typia/lib/tags/Format";

import type { IBbsArticle } from "../../../structures/IBbsArticle";

/**
* Store an article.
*
* @param input Content to store
* @returns Newly archived article
* @deprecated
*
* @controller BbsArticlesController.store
* @path POST /bbs/articles
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function store(
connection: IConnection,
input: store.Input,
): Promise<store.Output> {
return PlainFetcher.fetch(
{
...connection,
headers: {
...(connection.headers ?? {}),
"Content-Type": "application/json",
},
},
{
...store.METADATA,
path: store.path(),
} as const,
input,
);
}
export namespace store {
export type Input = Primitive<IBbsArticle.IStore>;
export type Output = Primitive<IBbsArticle>;

export const METADATA = {
method: "POST",
path: "/bbs/articles",
request: {
type: "application/json",
encrypted: false
},
response: {
type: "application/json",
encrypted: false,
},
status: null,
} as const;

export const path = (): string => {
return `/bbs/articles`;
}
}

/**
*
* @internal
*
* @controller BbsArticlesController.update
* @path PUT /bbs/articles/:id
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function update(
connection: IConnection,
id: string & Format<"uuid">,
input: update.Input,
): Promise<void> {
return PlainFetcher.fetch(
{
...connection,
headers: {
...(connection.headers ?? {}),
"Content-Type": "application/json",
},
},
{
...update.METADATA,
path: update.path(id),
} as const,
input,
);
}
export namespace update {
export type Input = Primitive<Partial<IBbsArticle.IStore>>;

export const METADATA = {
method: "PUT",
path: "/bbs/articles/:id",
request: {
type: "application/json",
encrypted: false
},
response: {
type: "application/json",
encrypted: false,
},
status: null,
} as const;

export const path = (id: string & Format<"uuid">): string => {
return `/bbs/articles/${encodeURIComponent(id ?? "null")}`;
}
}
7 changes: 7 additions & 0 deletions test/features/ignore/src/api/functional/bbs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @packageDocumentation
* @module api.functional.bbs
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
export * as articles from "./articles";
42 changes: 42 additions & 0 deletions test/features/ignore/src/api/functional/health/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* @packageDocumentation
* @module api.functional.health
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
import type { IConnection } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";

/**
* @controller HealthController.get
* @path GET /health
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function get(
connection: IConnection,
): Promise<void> {
return PlainFetcher.fetch(
connection,
{
...get.METADATA,
path: get.path(),
} as const,
);
}
export namespace get {

export const METADATA = {
method: "GET",
path: "/health",
request: null,
response: {
type: "application/json",
encrypted: false,
},
status: null,
} as const;

export const path = (): string => {
return `/health`;
}
}
9 changes: 9 additions & 0 deletions test/features/ignore/src/api/functional/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @packageDocumentation
* @module api.functional
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
export * as bbs from "./bbs";
export * as health from "./health";
export * as performance from "./performance";
45 changes: 45 additions & 0 deletions test/features/ignore/src/api/functional/performance/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @packageDocumentation
* @module api.functional.performance
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
import type { IConnection, Primitive } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";

import type { IPerformance } from "../../structures/IPerformance";

/**
* @controller PerformanceController.get
* @path GET /performance
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function get(
connection: IConnection,
): Promise<get.Output> {
return PlainFetcher.fetch(
connection,
{
...get.METADATA,
path: get.path(),
} as const,
);
}
export namespace get {
export type Output = Primitive<IPerformance>;

export const METADATA = {
method: "GET",
path: "/performance",
request: null,
response: {
type: "application/json",
encrypted: false,
},
status: null,
} as const;

export const path = (): string => {
return `/performance`;
}
}
4 changes: 4 additions & 0 deletions test/features/ignore/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as api from "./module";

export * from "./module";
export default api;
5 changes: 5 additions & 0 deletions test/features/ignore/src/api/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type * from "./IConnection";
export type * from "./Primitive";
export * from "./HttpError";

export * as functional from "./functional";
Loading
Loading