@tc-libs/doc 3.5.0 → 3.6.1

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.
Files changed (2) hide show
  1. package/README.md +73 -11
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -1,11 +1,73 @@
1
- # doc
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build doc` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test doc` to execute the unit tests via [Jest](https://jestjs.io).
1
+ # @tc-libs/doc
2
+
3
+ Helper Swagger/OpenAPI per uniformare la documentazione degli endpoint.
4
+
5
+ I decorator principali sono:
6
+
7
+ - `Doc()`
8
+ - `DocPaging()`
9
+ - `DocDefault()`
10
+ - `DocOneOf()`
11
+ - `DocAnyOf()`
12
+ - `DocAllOf()`
13
+
14
+ ## Cosa fa
15
+
16
+ Automatizza:
17
+
18
+ - `ApiConsumes` e `ApiProduces`
19
+ - response standard o paginata
20
+ - header `x-custom-lang`
21
+ - query di pagination
22
+ - documentazione errori standard del monorepo
23
+ - supporto auth JWT, refresh, API key e permission token
24
+
25
+ ## Esempio endpoint standard
26
+
27
+ ```ts
28
+ @Get(':id')
29
+ @Doc('user.get', {
30
+ auth: { jwtAccessToken: true },
31
+ response: {
32
+ serialization: UserGetSerialization,
33
+ },
34
+ request: {
35
+ params: [{ name: 'id', required: true, type: String }],
36
+ },
37
+ })
38
+ ```
39
+
40
+ ## Esempio endpoint paginato
41
+
42
+ ```ts
43
+ @Get()
44
+ @DocPaging('user.list', {
45
+ auth: { jwtAccessToken: true },
46
+ response: {
47
+ serialization: UserListSerialization,
48
+ availableSearch: ['email', 'name'],
49
+ availableOrderBy: ['createdAt', 'email'],
50
+ },
51
+ })
52
+ ```
53
+
54
+ ## Tipi utili
55
+
56
+ - `IDocOptions`
57
+ - `IDocPagingOptions`
58
+ - `IDocAuthOptions`
59
+ - `IDocRequestOptions`
60
+ - `IDocResponseOptions`
61
+
62
+ ## Note operative
63
+
64
+ - Per upload multipart usa `bodyType: FORM_DATA`.
65
+ - Per response file usa `bodyType: FILE`.
66
+ - Il package si appoggia ai serializzatori di `@tc-libs/response`.
67
+
68
+ ## Sviluppo
69
+
70
+ ```bash
71
+ nx build doc
72
+ nx test doc
73
+ ```
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tc-libs/doc",
3
- "version": "3.5.0",
3
+ "version": "3.6.1",
4
4
  "dependencies": {
5
- "@tc-libs/constant": "3.5.0",
6
- "@tc-libs/pagination": "3.5.0",
7
- "@tc-libs/request": "3.5.0",
8
- "@tc-libs/response": "3.5.0",
9
- "@tc-libs/errors": "3.5.0",
10
- "@tc-libs/file": "3.5.0",
5
+ "@tc-libs/constant": "3.6.1",
6
+ "@tc-libs/pagination": "3.6.1",
7
+ "@tc-libs/request": "3.6.1",
8
+ "@tc-libs/response": "3.6.1",
9
+ "@tc-libs/errors": "3.6.1",
10
+ "@tc-libs/file": "3.6.1",
11
11
  "@nestjs/common": "^11.0.12",
12
12
  "@nestjs/swagger": "^11.1.0",
13
13
  "class-transformer": "^0.5.1",