{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "API de Usuários" }, "host": "localhost:3000", "basePath": "/", "schemes": ["http"], "paths": { "/": { "get": { "tags": ["Users"], "summary": "Obter lista de usuários", "responses": { "200": { "description": "Lista de usuários", "schema": { "type": "array", "items": { "$ref": "#/definitions/User" } } }, "500": { "description": "Erro na consulta de usuários" } } } }, "/create": { "post": { "tags": ["Users"], "summary": "Cria um novo usuário", "parameters": [ { "name": "body", "in": "body", "description": "Dados do usuário", "required": true, "schema": { "$ref": "#/definitions/NewUser" } } ], "responses": { "201": { "description": "Usuário criado com sucesso", "schema": { "type": "object", "properties": { "user": { "$ref": "#/definitions/User" }, "token": { "type": "string" } } } }, "400": { "description": "Dados insuficientes ou email já cadastrado" }, "500": { "description": "Não foi possível buscar" } } } }, "/auth": { "post": { "tags": ["Users"], "summary": "Autentica um usuário", "parameters": [ { "name": "body", "in": "body", "description": "Dados de autenticação", "required": true, "schema": { "$ref": "#/definitions/Auth" } } ], "responses": { "200": { "description": "Usuário autenticado com sucesso", "schema": { "type": "object", "properties": { "user": { "$ref": "#/definitions/User" }, "token": { "type": "string" } } } }, "400": { "description": "Dados insuficientes ou usuário não registrado" }, "401": { "description": "Senha incorreta" }, "500": { "description": "Não foi possível buscar" } } } } }, "definitions": { "NewUser": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "required": ["email", "password"] }, "Auth": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "required": ["email", "password"] }, "User": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "email": { "type": "string" } }, "required": ["id", "email"] } } }