Skip to content

Commit 2321037

Browse files
committed
docs(swagger): fix indentation and formatting errors in OpenAPI spec
1 parent 8e8cc96 commit 2321037

File tree

1 file changed

+80
-77
lines changed

1 file changed

+80
-77
lines changed

docs/openapi.yaml

Lines changed: 80 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,133 @@
11
openapi: 3.0.3
22
info:
3-
title: Supabase → Z-API (Documentação)
3+
title: Supabase → Z-API (Docs)
44
version: "1.0.0"
55
description: |
6-
Documentação do fluxo de envio de WhatsApp:
7-
- Busca contatos ativos no Supabase
6+
Documentação ilustrativa do fluxo:
7+
- contatos ativos no Supabase
88
- Envia mensagem personalizada via Z-API
99
1010
servers:
11-
- url: http://localhost # apenas ilustrativo
11+
- url: http://localhost
12+
description: "Somente ilustrativo (não há servidor HTTP neste projeto)"
1213

1314
paths:
1415
/contacts:
1516
get:
16-
summary: Listar contatos ativos (fonte: Supabase)
17-
description: |
18-
Equivalente ao que `fetch_contacts(limit)` faz no código.
17+
summary: "Listar contatos ativos (Supabase)"
18+
description: >
19+
Este endpoint é apenas documentação do que o script faz ao consultar o Supabase.
20+
Não existe rota HTTP no projeto; isto é uma representação.
1921
parameters:
2022
- in: query
2123
name: limit
22-
schema: { type: integer, minimum: 1, default: 3 }
23-
description: Número máximo de contatos
24+
required: false
25+
schema:
26+
type: integer
27+
minimum: 1
28+
default: 3
29+
description: "Número máximo de contatos"
2430
responses:
2531
"200":
26-
description: Contatos retornados
32+
description: "Contatos retornados"
2733
content:
2834
application/json:
2935
schema:
30-
type: object
31-
properties:
32-
count: { type: integer }
33-
items:
34-
type: array
35-
items:
36-
$ref: "#/components/schemas/Contact"
36+
$ref: "#/components/schemas/ContactsResponse"
3737
examples:
38-
exemplo:
38+
demo:
3939
value:
4040
count: 3
4141
items:
42-
- id: "1206b580-ea..."
42+
- id: "1206b580-aaaa-bbbb-cccc-111111111111"
4343
name: "Breno"
4444
phone: "5518996628576"
4545
active: true
46-
- id: "a839c618-95e..."
46+
- id: "a389c618-aaaa-bbbb-cccc-222222222222"
4747
name: "Washington"
4848
phone: "5511948054059"
4949
active: true
50+
- id: "dba0426c-aaaa-bbbb-cccc-333333333333"
51+
name: "Carla"
52+
phone: "5581999999999"
53+
active: true
5054

51-
/send:
55+
/send-message:
5256
post:
53-
summary: Disparar envio de mensagens
54-
description: |
55-
Para cada contato retornado do Supabase, envia
56-
**"Olá {nome}, tudo bem com você?"** via Z-API.
57+
summary: "Enviar mensagem via Z-API"
58+
description: >
59+
Documenta a chamada que o script faz para a Z-API usando o header `Client-Token`.
60+
Representação apenas para fins de documentação.
5761
requestBody:
58-
required: false
62+
required: true
5963
content:
6064
application/json:
6165
schema:
62-
type: object
63-
properties:
64-
limit:
65-
type: integer
66-
description: Número de contatos a enviar
67-
default: 3
66+
$ref: "#/components/schemas/SendMessageRequest"
67+
examples:
68+
demo:
69+
value:
70+
phone: "5511999999999"
71+
message: "Ola Breno, tudo bem com voce?"
6872
responses:
6973
"200":
70-
description: Resultado do disparo
74+
description: "Resposta encaminhada da Z-API"
7175
content:
7276
application/json:
7377
schema:
74-
$ref: "#/components/schemas/SendResponse"
75-
examples:
76-
sucesso:
77-
value:
78-
sent: 3
79-
failed: 0
80-
results:
81-
- id: "a839c618-95e..."
82-
name: "Washington"
83-
phone: "5511948054059"
84-
ok: true
85-
status: 200
86-
- id: "1206b580-ea..."
87-
name: "Breno"
88-
phone: "5518996628576"
89-
ok: true
90-
status: 200
78+
$ref: "#/components/schemas/SendMessageResponse"
79+
"400":
80+
description: "Payload invalido ou token ausente"
9181

9282
components:
9383
schemas:
9484
Contact:
9585
type: object
86+
required: [id, name, phone, active]
9687
properties:
97-
id: { type: string, format: uuid }
98-
name: { type: string }
99-
phone: { type: string, description: "Somente dígitos (E.164 sem '+')" }
100-
active: { type: boolean }
101-
required: [name, phone]
88+
id:
89+
type: string
90+
format: uuid
91+
name:
92+
type: string
93+
phone:
94+
type: string
95+
description: "Numero E.164 apenas digitos (ex.: 5511999999999)"
96+
active:
97+
type: boolean
10298

103-
SendItem:
99+
ContactsResponse:
104100
type: object
105101
properties:
106-
id: { type: string, nullable: true }
107-
name: { type: string }
108-
phone: { type: string }
109-
ok: { type: boolean }
110-
status: { type: integer, nullable: true }
111-
error: { type: string, nullable: true }
102+
count:
103+
type: integer
104+
items:
105+
type: array
106+
items:
107+
$ref: "#/components/schemas/Contact"
112108

113-
SendResponse:
109+
SendMessageRequest:
114110
type: object
111+
required: [phone, message]
115112
properties:
116-
sent: { type: integer }
117-
failed: { type: integer }
118-
results:
119-
type: array
120-
items: { $ref: "#/components/schemas/SendItem" }
113+
phone:
114+
type: string
115+
example: "5511999999999"
116+
message:
117+
type: string
118+
example: "Ola Breno, tudo bem com voce?"
121119

122-
securitySchemes:
123-
ZapiClientToken:
124-
type: apiKey
125-
in: header
126-
name: Client-Token
127-
description: Token configurado na aba Segurança da Z-API
128-
129-
security:
130-
- ZapiClientToken: []
120+
SendMessageResponse:
121+
type: object
122+
properties:
123+
ok:
124+
type: boolean
125+
example: true
126+
status:
127+
type: integer
128+
example: 200
129+
data:
130+
type: object
131+
nullable: true
132+
example:
133+
messageId: "abcd-1234"

0 commit comments

Comments
 (0)