-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
130 lines (126 loc) · 3.38 KB
/
Copy pathopenapi.yaml
File metadata and controls
130 lines (126 loc) · 3.38 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
swagger: "2.0"
info:
title: "Go Messages API"
description: "API REST básica en Go para manejar mensajes"
version: "1.0.0"
host: YOUR-PROJECT-ID.appspot.com # e.g., immune-institute.appspot.com
x-google-endpoints:
- name: YOUR-PROJECT-ID.appspot.com # e.g., immune-institute-293912.appspot.com
allowCors: true
schemes:
- https
produces:
- "application/json"
consumes:
- "application/json"
paths:
/messages:
get:
summary: "Obtener todos los mensajes"
description: "Lista todos los mensajes"
operationId: listMessages
responses:
"200":
description: "Lista de mensajes"
schema:
type: array
items:
$ref: "#/definitions/Message"
post:
summary: "Crear un nuevo mensaje"
description: "Crea un nuevo mensaje"
operationId: createMessage
parameters:
- name: "body"
in: "body"
required: true
schema:
$ref: "#/definitions/NewMessage"
responses:
"201":
description: "Mensaje creado exitosamente"
schema:
$ref: "#/definitions/Message"
"400":
description: "Solicitud inválida"
"/messages/{id}":
parameters:
- name: id
in: path
required: true
type: integer
format: int32
get:
summary: "Obtener un mensaje específico por ID"
description: "Obtiene un mensaje específico"
operationId: getMessage
responses:
"200":
description: "Mensaje encontrado"
schema:
$ref: "#/definitions/Message"
"404":
description: "Mensaje no encontrado"
put:
summary: "Actualizar un mensaje por ID"
description: "Actualiza un mensaje"
operationId: updateMessage
parameters:
- name: "body"
in: "body"
required: true
schema:
$ref: "#/definitions/NewMessage"
responses:
"200":
description: "Mensaje actualizado"
schema:
$ref: "#/definitions/Message"
"400":
description: "Solicitud inválida"
"404":
description: "Mensaje no encontrado"
delete:
summary: "Eliminar un mensaje por ID"
description: "Elimina un mensaje"
operationId: deleteMessage
responses:
"204":
description: "Mensaje eliminado"
"404":
description: "Mensaje no encontrado"
# This endpoint for serving HTML might be better handled directly by Cloud Run
# or a separate frontend service, but can be proxied by Endpoints if needed.
/:
get:
summary: "Página HTML de inicio"
description: "Página HTML de inicio"
operationId: serveHTML
produces:
- text/html
responses:
"200":
description: OK
x-google-backend:
# This should be the full HTTPS URL of your deployed 'go-rest-api' Cloud Run service.
address: YOUR-CLOUD-RUN-ENDPOINT # e.g., https://go-rest-api-abcdef1234-ew.a.run.app
# --- Schema Definitions for API Request/Response Bodies ---
definitions:
Message:
type: "object"
properties:
id:
type: "integer"
format: "int32"
content:
type: "string"
required:
- "id"
- "content"
NewMessage:
type: "object"
properties:
content:
type: "string"
required:
- "content"