Add OpenAPI spec for POST /events endpoint
Define CreateEventRequest, CreateEventResponse, ProblemDetail, and ValidationProblemDetail schemas. RFC 9457 problem details for errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,27 +11,120 @@ servers:
|
|||||||
- url: /api
|
- url: /api
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/health:
|
/events:
|
||||||
get:
|
post:
|
||||||
operationId: getHealth
|
operationId: createEvent
|
||||||
summary: Health check
|
summary: Create a new event
|
||||||
tags:
|
tags:
|
||||||
- health
|
- events
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateEventRequest"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"201":
|
||||||
description: Service is healthy
|
description: Event created successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/HealthResponse"
|
$ref: "#/components/schemas/CreateEventResponse"
|
||||||
|
"400":
|
||||||
|
description: Validation failed
|
||||||
|
content:
|
||||||
|
application/problem+json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ValidationProblemDetail"
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
HealthResponse:
|
CreateEventRequest:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- status
|
- title
|
||||||
|
- dateTime
|
||||||
|
- expiryDate
|
||||||
properties:
|
properties:
|
||||||
status:
|
title:
|
||||||
type: string
|
type: string
|
||||||
example: UP
|
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
|
||||||
|
organizerToken:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
description: Secret token for organizer access
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
dateTime:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
expiryDate:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user