openapi: 3.0.3 info: title: API de Cadastro de Clientes version: 1.0.0 description: > Formulário público de cadastro de clientes: cores servidas por tabela e unicidade de CPF e e-mail. servers: - url: /api paths: /health: get: summary: Verifica a saúde da aplicação e do banco de dados responses: '200': description: Aplicação e banco de dados no ar content: application/json: schema: $ref: '#/components/schemas/HealthOk' '503': description: Banco de dados indisponível content: application/json: schema: $ref: '#/components/schemas/HealthError' /colors: get: summary: Lista as cores ativas, ordenadas por sortOrder responses: '200': description: Lista de cores ativas content: application/json: schema: $ref: '#/components/schemas/ColorList' /clients: post: summary: Cadastra um cliente requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateClientInput' responses: '201': description: Cliente cadastrado com sucesso content: application/json: schema: $ref: '#/components/schemas/CreateClientOutput' '400': description: Dados inválidos content: application/json: schema: $ref: '#/components/schemas/ApiError' '409': description: CPF ou e-mail já cadastrado content: application/json: schema: $ref: '#/components/schemas/ApiError' '422': description: Cor inexistente ou inativa content: application/json: schema: $ref: '#/components/schemas/ApiError' '429': description: Limite de requisições excedido content: application/json: schema: $ref: '#/components/schemas/ApiError' components: schemas: HealthOk: type: object properties: status: type: string example: ok database: type: string example: up uptime: type: number example: 128.4 HealthError: type: object properties: status: type: string example: error database: type: string example: down uptime: type: number Color: type: object properties: id: type: string format: uuid name: type: string hexCode: type: string example: '#FF0000' sortOrder: type: integer ColorList: type: object properties: data: type: array items: $ref: '#/components/schemas/Color' CreateClientInput: type: object required: - fullName - cpf - email - colorId properties: fullName: type: string example: Maria Souza cpf: type: string example: '52998224725' email: type: string format: email example: maria@exemplo.com colorId: type: string format: uuid notes: type: string description: Opcional; omita o campo quando não houver observação (não envie null). maxLength: 500 CreateClientOutput: type: object properties: id: type: string format: uuid createdAt: type: string format: date-time ApiErrorDetail: type: object properties: field: type: string message: type: string ApiError: type: object properties: statusCode: type: integer error: type: string message: type: string details: type: array items: $ref: '#/components/schemas/ApiErrorDetail'