-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
158 lines (146 loc) · 4.15 KB
/
openapi.yaml
File metadata and controls
158 lines (146 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
openapi: 3.0.3
info:
title: ChaplinPoopManager
description: |-
This is the contract for the communication between backend and front or sensors
version: 1.0.0
contact:
name: Santiago Sanchez
url: gaugelife.co
email: email.gaugelife@gmail.com
servers:
- url: https://render.com/v1
description: Production Server
tags:
- name: HealthCheck
- name: Auth
description: Services related to users
- name: Pets
description: Services related to users
paths:
/healtch-check:
get:
tags:
- HealthCheck
summary: Validates that the service is running.
description: Responds a life check of the service
operationId: getHealthCheck
responses:
'200':
description: Service is running
content:
application/json:
schema:
$ref: '#/components/schemas/ArregloUsuarios'
'500':
description: Error interno del servidor.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/auth/create-user:
post:
tags:
- Auth
summary: Create a user
description: Create a user on database. Returns the user
operationId: createUser
parameters:
- name: limite
in: query
description: Número máximo de usuarios a devolver
required: false
schema:
type: integer
format: int32
# Las posibles respuestas de la operación.
responses:
'200':
description: Operación exitosa. Devuelve una lista de usuarios.
content:
application/json:
schema:
# Referencia a un componente reutilizable.
$ref: '#/components/schemas/ArregloUsuarios'
'500':
description: Error interno del servidor.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# Ruta para operaciones sobre un recurso específico, identificado por un ID.
/usuarios/{usuarioId}:
get:
tags:
- Usuarios
summary: Obtener un usuario por su ID
description: Devuelve los detalles de un usuario específico.
operationId: getUsuarioPorId
parameters:
- name: usuarioId
# El parámetro está en la ruta (path).
in: path
description: ID del usuario a obtener
required: true
schema:
type: string
format: uuid # o integer, dependiendo de tu sistema
responses:
'200':
description: Usuario encontrado.
content:
application/json:
schema:
$ref: '#/components/schemas/Usuario'
'404':
description: Usuario no encontrado.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# Componentes reutilizables. Esto ayuda a mantener tu especificación limpia y organizada (DRY).
components:
# Esquemas de datos (modelos).
schemas:
Usuario:
type: object
properties:
id:
type: string
format: uuid
description: El identificador único del usuario.
example: '123e4567-e89b-12d3-a456-426614174000'
nombre:
type: string
example: 'Juan'
apellido:
type: string
example: 'Pérez'
email:
type: string
format: email
example: 'juan.perez@email.com'
ArregloUsuarios:
type: array
items:
$ref: '#/components/schemas/Usuario'
Error:
type: object
properties:
codigo:
type: integer
example: 404
mensaje:
type: string
example: 'Recurso no encontrado.'
# Esquemas de seguridad.
securitySchemes:
# Ejemplo de autenticación con Bearer Token (JWT).
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
# Define qué esquemas de seguridad se aplican globalmente a toda la API.
# También se puede aplicar a operaciones específicas.
security:
- bearerAuth: []