Skip to content

Commit ce4db4f

Browse files
authored
docs: Fix DTO in API documentation (#86)
* fix: dto names * docs: add descriptions * docs: add required properties * docs: add uuid format in user model * refactor: * refactor: doc * fix: doc * fix: typo
1 parent c3b8fe6 commit ce4db4f

File tree

14 files changed

+57
-6
lines changed

14 files changed

+57
-6
lines changed

src/app/api/vaults/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type { CreateVaultPayloadDto } from '@shared/dto/input/payloads/create-va
2323
* content:
2424
* application/json:
2525
* schema:
26-
* $ref: '#/components/schemas/GetMyVaultsBodyDto'
26+
* $ref: '#/components/schemas/GetMyVaultsDataDto'
2727
* 401:
2828
* description: Unauthorized
2929
* content:
@@ -71,7 +71,7 @@ export async function GET(
7171
* content:
7272
* application/json:
7373
* schema:
74-
* $ref: '#/components/schemas/CreateVaultBodyDto'
74+
* $ref: '#/components/schemas/CreateVaultDataDto'
7575
* 409:
7676
* description: Vault already exists
7777
* content:

src/modules/shared/dto/input/payloads/create-vault.payload.dto.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
* properties:
1111
* label:
1212
* type: string
13-
* description: Name of the vault
13+
* description: name of the vault
14+
* example: Google, Amazon, Netflix, Disney+ or the other
1415
* secret:
1516
* type: string
16-
* description: Password, token, or other sensitive string to store
17+
* description: password, token, code or other sensitive string to store
1718
* format: password
1819
*/
1920
export type CreateVaultPayloadDto = {

src/modules/shared/dto/input/payloads/register.payload.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
* properties:
1111
* email:
1212
* type: string
13+
* description: email of new user
1314
* format: email
1415
* password:
1516
* type: string
17+
* description: plain password of new user
1618
* format: password
1719
* name:
1820
* type: string
21+
* description: first name and last name of the new user
1922
*/
2023
export type RegisterPayloadDto = {
2124
email: string;

src/modules/shared/dto/input/payloads/sign-in.payload.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
* properties:
1111
* email:
1212
* type: string
13+
* description: email of user to sign
1314
* format: email
1415
* password:
1516
* type: string
17+
* description: plain password of user to sign
1618
* format: password
1719
*/
1820
export type SignInPayloadDto = {

src/modules/shared/dto/models/provider.model.dto.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
* schemas:
55
* ProviderModelDto:
66
* type: object
7+
* required:
8+
* - id
9+
* - name
10+
* - type
11+
* - signinUrl
12+
* - callbackUrl
713
* properties:
814
* id:
915
* type: string

src/modules/shared/dto/models/user.model.dto.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
* properties:
1111
* id:
1212
* type: string
13+
* description: UUID
14+
* format: uuid
1315
* email:
1416
* type: string
17+
* description: user's email
1518
* format: email
1619
* name:
1720
* type: string
21+
* description: first name and last name
1822
*/
1923
export type UserModelDto = {
2024
id: string;

src/modules/shared/dto/models/vault.model.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
* schemas:
55
* VaultModelDto:
66
* type: object
7+
* required:
8+
* - id
9+
* - label
10+
* - secret
711
* properties:
812
* id:
913
* type: string
14+
* description: UUID
1015
* format: uuid
1116
* label:
1217
* type: string
18+
* description: name of the vault
19+
* example: Google, Amazon, Netflix, Disney+ or the other
1320
* secret:
1421
* type: string
22+
* description: password, token, code or other sensitive string to store
1523
* format: password
1624
*/
1725
export type VaultModelDto = {

src/modules/shared/dto/output/body/session.body.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
* properties:
1616
* email:
1717
* type: string
18+
* description: current user's email
1819
* format: email
1920
* name:
2021
* type: string
22+
* description: current user's name
2123
* nullable: true
2224
* expires:
2325
* type: string

src/modules/shared/dto/output/data/create-vault.data.dto.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import type { VaultModelDto } from '@shared/dto/models/vault.model.dto';
44
* @swagger
55
* components:
66
* schemas:
7-
* CreateVaultBodyDto:
7+
* CreateVaultDataDto:
88
* type: object
9+
* required:
10+
* - data
911
* properties:
1012
* data:
1113
* type: object
14+
* required:
15+
* - vaultCreated
1216
* properties:
1317
* vaultCreated:
1418
* $ref: '#/components/schemas/VaultModelDto'

src/modules/shared/dto/output/data/get-my-vaults.data.dto.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import type { VaultModelDto } from '@shared/dto/models/vault.model.dto';
44
* @swagger
55
* components:
66
* schemas:
7-
* GetMyVaultsBodyDto:
7+
* GetMyVaultsDataDto:
88
* type: object
9+
* required:
10+
* - data
911
* properties:
1012
* data:
1113
* type: object
14+
* required:
15+
* - myVaults
1216
* properties:
1317
* myVaults:
1418
* type: array

0 commit comments

Comments
 (0)