nestia 2.1.0-dev.20220505 → 2.1.0-dev.20220506

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Nestia
2
- Automatic SDK generator for the NestJS.
2
+ Automatic `SDK` and `swagger.json` generator for the NestJS.
3
3
 
4
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
5
  [![npm version](https://badge.fury.io/js/nestia.svg)](https://www.npmjs.com/package/nestia)
@@ -20,17 +20,17 @@ npx nestia sdk "src/**/*.controller.ts" --out "src/api"
20
20
  npx nestia swagger "src/controller" -- out "swagger.json"
21
21
  ```
22
22
 
23
- Don't write any `swagger` comment or decorator. Just deliver the SDK.
23
+ Don't write any `swagger` comment or DTO decorator. Just deliver the SDK.
24
24
 
25
25
  - No swagger comment/decorator
26
26
  - No DTO comment/decorator
27
27
  - Only pure NestJS source code and interface structures are required
28
28
 
29
- When you're developing a backend server using the `NestJS`, you don't need any extra dedication, for delivering the Rest API to the client developers, like writing the `swagger` comments or decorators.
29
+ When you're developing a backend server using the `NestJS`, you don't need any extra dedication, for delivering the Rest API to the client developers, like writing the `swagger` comments or DTO decorators.
30
30
 
31
- You just run this **Nestia** up, then **Nestia** would generate the SDK automatically, by analyzing your controller classes in the compliation and runtime level. Even generating the `swagger.json` without any swagger comment or decorator is also possible. When generating the SDK or `swwagger.json`, no DTO comment or decorator is required. Use only the pure interface definitions.
31
+ You just run this **Nestia** up, then **Nestia** would generate the SDK automatically, by analyzing your controller classes in the compliation and runtime level. With the automatically generated SDK through this **Nestia**, client developer also does not need any extra work, like reading `swagger` and writing the duplicated interaction code. Client developer only needs to import the SDK and calls matched function with the `await` symbol.
32
32
 
33
- With the automatically generated SDK through this **Nestia**, client developer also does not need any extra work, like reading `swagger` and writing the duplicated interaction code. Client developer only needs to import the SDK and calls matched function with the `await` symbol.
33
+ > Even generating the `swagger.json` without any swagger comment and DTO decorator is also possible. When generating the `swagger.json`, no DTO comment and decorator is required, either. Use only the pure interface definitions.
34
34
 
35
35
  ```typescript
36
36
  import api from "@samchon/bbs-api";
@@ -108,7 +108,7 @@ Also, when generating a SDK using the cli options, `compilerOptions` would follo
108
108
  npx nestia install
109
109
  ```
110
110
 
111
- SDK library generated by the **Nestia** requires the [nestia-fetcher](https://github.com/samchon/nestia-fetcher) and [typescript-is](https://github.com/woutervh-/typescript-is) modules.
111
+ SDK library generated by the **Nestia** requires the [nestia-fetcher](https://github.com/samchon/nestia-fetcher) module. Also, the [typescript-is](https://github.com/woutervh-/typescript-is) and [typescript-json](https://github.com/samchon/typescript-json) modules can be required following your [nestia.config.ts](#nestiaconfigts) options.
112
112
 
113
113
  The `npx nestia install` command installs those dependencies with `package.json` configuration.
114
114
 
@@ -116,8 +116,9 @@ The `npx nestia install` command installs those dependencies with `package.json`
116
116
  {
117
117
  "name": "payments-server-api",
118
118
  "dependencies": {
119
- "nestia-fetcher": "^2.0.0",
120
- "typescript-is": "^0.19.0"
119
+ "nestia-fetcher": "^2.0.1",
120
+ "typescript-is": "^0.19.0",
121
+ "typescript-json": "^2.0.9"
121
122
  }
122
123
  }
123
124
  ```
@@ -442,9 +443,9 @@ export namespace store
442
443
  ```
443
444
 
444
445
  ### `swagger.json`
445
- Even the `swagger.json` does not require any swagger comment or decorator function.
446
+ Even the `swagger.json` generation does not require any swagger comment and DTO decorator.
446
447
 
447
- The **Nestia** will generate the perfect `swagger.json` automatically, by analyzing your source code (DTO interface and controller class) in the compilation and runtime level. Even your descriptive comments would be placed into the adequate `description` property in the `swagger.json`.
448
+ The **Nestia** will generate the perfect `swagger.json` automatically, by analyzing your source code (DTO interface and controller class) in the compilation and runtime level. Furthermore, your descriptive comments would be automatically assigned into the adequate `description` property in the `swagger.json`.
448
449
 
449
450
  ```json
450
451
  {
@@ -587,6 +588,21 @@ The **Nestia** will generate the perfect `swagger.json` automatically, by analyz
587
588
  "body"
588
589
  ],
589
590
  "description": "Content info."
591
+ },
592
+ "ISaleComment.IStore": {
593
+ "type": "object",
594
+ "properties": {
595
+ "body": {
596
+ "description": "Body of the content.",
597
+ "type": "string",
598
+ "nullable": false
599
+ }
600
+ },
601
+ "nullable": false,
602
+ "required": [
603
+ "body"
604
+ ],
605
+ "description": "Store info."
590
606
  }
591
607
  }
592
608
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,yBAAiB,gBAAgB,CACjC;IACI,SAAsB,QAAQ,CAEtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,cAAc,CAAC,QAAQ,EAC/B,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAsCnB;CAuMJ"}
1
+ {"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,yBAAiB,gBAAgB,CACjC;IACI,SAAsB,QAAQ,CAEtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,cAAc,CAAC,QAAQ,EAC/B,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAsCnB;CA0NJ"}
@@ -141,6 +141,9 @@ var SwaggerGenerator;
141
141
  });
142
142
  }
143
143
  SwaggerGenerator.generate = generate;
144
+ /* ---------------------------------------------------------
145
+ INITIALIZERS
146
+ --------------------------------------------------------- */
144
147
  function initialize(path) {
145
148
  return __awaiter(this, void 0, void 0, function () {
146
149
  var swagger, _a, _b, _c;
@@ -193,8 +196,18 @@ var SwaggerGenerator;
193
196
  }
194
197
  function generate_route(checker, collection, route) {
195
198
  var bodyParam = route.parameters.find(function (param) { return param.category === "body"; });
199
+ var tags = route.tags
200
+ .filter(function (tag) {
201
+ return tag.name === "tag" &&
202
+ tag.text &&
203
+ tag.text.find(function (elem) {
204
+ return elem.kind === "text" &&
205
+ elem.text.length;
206
+ }) !== undefined;
207
+ })
208
+ .map(function (tag) { return tag.text.find(function (elem) { return elem.kind === "text"; }).text; });
196
209
  return {
197
- tags: [],
210
+ tags: tags,
198
211
  parameters: route.parameters
199
212
  .filter(function (param) { return param.category !== "body"; })
200
213
  .map(function (param) { return generate_parameter(checker, collection, route, param); }),
@@ -205,6 +218,9 @@ var SwaggerGenerator;
205
218
  description: CommentFactory_1.CommentFactory.generate(route.comments)
206
219
  };
207
220
  }
221
+ /* ---------------------------------------------------------
222
+ REQUEST & RESPONSE
223
+ --------------------------------------------------------- */
208
224
  function generate_parameter(checker, collection, route, parameter) {
209
225
  return {
210
226
  name: parameter.name,
@@ -269,6 +285,9 @@ var SwaggerGenerator;
269
285
  }));
270
286
  return __assign(__assign({}, exceptions), success);
271
287
  }
288
+ /* ---------------------------------------------------------
289
+ UTILS
290
+ --------------------------------------------------------- */
272
291
  function generate_schema(checker, collection, type) {
273
292
  var entity = MetadataFactory_1.MetadataFactory.generate(checker, type, collection);
274
293
  return SchemaFactory_1.SchemaFactory.schema((entity === null || entity === void 0 ? void 0 : entity.metadata) || null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "2.1.0-dev.20220505",
3
+ "version": "2.1.0-dev.20220506",
4
4
  "description": "Automatic SDK and Document generator for the NestJS",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",