Skip to content

Commit 6003e61

Browse files
authored
Create swagger.yaml
1 parent 3c44431 commit 6003e61

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

swagger.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
openapi: 3.0.0
2+
info:
3+
title: API de Produtos
4+
version: 1.0.0
5+
paths:
6+
/health:
7+
get:
8+
summary: Verificar status da aplicação
9+
responses:
10+
'200':
11+
description: Status da aplicação
12+
content:
13+
application/json:
14+
schema:
15+
type: object
16+
properties:
17+
status:
18+
type: string
19+
/products:
20+
get:
21+
summary: Listar todos os produtos
22+
responses:
23+
'200':
24+
description: Lista de produtos
25+
content:
26+
application/json:
27+
schema:
28+
type: array
29+
items:
30+
$ref: '#/components/schemas/Product'
31+
post:
32+
summary: Criar produto
33+
requestBody:
34+
required: true
35+
content:
36+
application/json:
37+
schema:
38+
$ref: '#/components/schemas/ProductInput'
39+
responses:
40+
'201':
41+
description: Produto criado
42+
content:
43+
application/json:
44+
schema:
45+
$ref: '#/components/schemas/Product'
46+
/products/{id}:
47+
get:
48+
summary: Buscar produto específico
49+
parameters:
50+
- name: id
51+
in: path
52+
required: true
53+
schema:
54+
type: string
55+
responses:
56+
'200':
57+
description: Informações do produto
58+
content:
59+
application/json:
60+
schema:
61+
$ref: '#/components/schemas/Product'
62+
put:
63+
summary: Atualizar produto
64+
parameters:
65+
- name: id
66+
in: path
67+
required: true
68+
schema:
69+
type: string
70+
requestBody:
71+
required: true
72+
content:
73+
application/json:
74+
schema:
75+
$ref: '#/components/schemas/ProductInput'
76+
responses:
77+
'200':
78+
description: Produto atualizado
79+
content:
80+
application/json:
81+
schema:
82+
$ref: '#/components/schemas/Product'
83+
delete:
84+
summary: Deletar produto
85+
parameters:
86+
- name: id
87+
in: path
88+
required: true
89+
schema:
90+
type: string
91+
responses:
92+
'204':
93+
description: Produto deletado
94+
components:
95+
schemas:
96+
Product:
97+
type: object
98+
properties:
99+
id:
100+
type: string
101+
nome:
102+
type: string
103+
preço:
104+
type: number
105+
descrição:
106+
type: string
107+
ProductInput:
108+
type: object
109+
properties:
110+
nome:
111+
type: string
112+
preço:
113+
type: number
114+
descrição:
115+
type: string

0 commit comments

Comments
 (0)