Required for @msw/source mock generation in E2E tests. Also good OpenAPI documentation practice.
136 lines
3.3 KiB
YAML
136 lines
3.3 KiB
YAML
openapi: 3.1.0
|
|
info:
|
|
title: fete API
|
|
description: Privacy-focused event announcements and RSVPs
|
|
version: 0.1.0
|
|
license:
|
|
name: GPL-3.0-or-later
|
|
identifier: GPL-3.0-or-later
|
|
|
|
servers:
|
|
- url: /api
|
|
|
|
paths:
|
|
/events:
|
|
post:
|
|
operationId: createEvent
|
|
summary: Create a new event
|
|
tags:
|
|
- events
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/CreateEventRequest"
|
|
responses:
|
|
"201":
|
|
description: Event created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/CreateEventResponse"
|
|
"400":
|
|
description: Validation failed
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/ValidationProblemDetail"
|
|
|
|
components:
|
|
schemas:
|
|
CreateEventRequest:
|
|
type: object
|
|
required:
|
|
- title
|
|
- dateTime
|
|
- expiryDate
|
|
properties:
|
|
title:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 200
|
|
description:
|
|
type: string
|
|
maxLength: 2000
|
|
dateTime:
|
|
type: string
|
|
format: date-time
|
|
description: Event date and time with UTC offset (ISO 8601)
|
|
example: "2026-03-15T20:00:00+01:00"
|
|
location:
|
|
type: string
|
|
maxLength: 500
|
|
expiryDate:
|
|
type: string
|
|
format: date
|
|
description: Date after which event data is deleted. Must be in the future.
|
|
example: "2026-06-15"
|
|
|
|
CreateEventResponse:
|
|
type: object
|
|
required:
|
|
- eventToken
|
|
- organizerToken
|
|
- title
|
|
- dateTime
|
|
- expiryDate
|
|
properties:
|
|
eventToken:
|
|
type: string
|
|
format: uuid
|
|
description: Public token for the event URL
|
|
example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
organizerToken:
|
|
type: string
|
|
format: uuid
|
|
description: Secret token for organizer access
|
|
example: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
|
|
title:
|
|
type: string
|
|
example: "Summer BBQ"
|
|
dateTime:
|
|
type: string
|
|
format: date-time
|
|
example: "2026-03-15T20:00:00+01:00"
|
|
expiryDate:
|
|
type: string
|
|
format: date
|
|
example: "2026-06-15"
|
|
|
|
ProblemDetail:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
format: uri
|
|
default: "about:blank"
|
|
title:
|
|
type: string
|
|
status:
|
|
type: integer
|
|
detail:
|
|
type: string
|
|
instance:
|
|
type: string
|
|
format: uri
|
|
additionalProperties: true
|
|
|
|
ValidationProblemDetail:
|
|
allOf:
|
|
- $ref: "#/components/schemas/ProblemDetail"
|
|
- type: object
|
|
properties:
|
|
fieldErrors:
|
|
type: array
|
|
items:
|
|
type: object
|
|
required:
|
|
- field
|
|
- message
|
|
properties:
|
|
field:
|
|
type: string
|
|
message:
|
|
type: string
|