openapi: 3.0.3 info: title: Votación del viaje de fin de curso version: "1.0" description: Contrato común entre la web y la API de cada escuadrón. paths: /api/opciones: get: summary: Opciones de viaje responses: "200": description: Lista de opciones content: application/json: schema: {type: array, items: {type: string}, example: ["Ibiza", "Praga"]} /api/votos: post: summary: Emitir un voto requestBody: required: true content: application/json: schema: type: object required: [codigo, opcion] properties: codigo: {type: string, example: "A0001"} opcion: {type: string, example: "Ibiza"} responses: "201": {description: Voto guardado} "400": {description: Opción no válida (o cuerpo mal formado), content: {application/json: {schema: {$ref: "#/components/schemas/Error"}}}} "403": {description: Código fuera del censo, content: {application/json: {schema: {$ref: "#/components/schemas/Error"}}}} "409": {description: Ese código ya ha votado, content: {application/json: {schema: {$ref: "#/components/schemas/Error"}}}} /api/resultados: get: summary: Recuento responses: "200": description: Votos por opción y total content: application/json: schema: type: object required: [Ibiza, Praga, total] properties: Ibiza: {type: integer} Praga: {type: integer} total: {type: integer} example: {Ibiza: 12, Praga: 3, total: 15} /healthz: get: summary: Salud responses: "200": {description: La API está viva} components: schemas: Error: type: object properties: error: {type: string, example: "Ese código ya ha votado"}