API
The HTTP API is described in OpenAPI 3.1. Every package adds its operations in openapi/. The core
merges the contracts of all installed packages and serves them as /api/.
In the merged document the path items are written out, and every schema, parameter, response, header and security
scheme a $ref names is kept once under components and referenced from there (#/).
When two packages use the same name, the later package's part gets the package as prefix, for example
Leave.
Contract layout
A contract consists of a root file, path files and component files:
packages/web-vision/adsum-working-time/openapi/
openapi.yaml root: metadata, tags and the list of paths
paths/working-time.yaml one entry per path item
components/working-time.yaml schemas
The root file lists the paths and refers to the entries of the path files:
openapi: 3.1.0
info:
title: Time Tracking API, working-time package
version: 1.0.0
servers:
- url: /api/v1
security:
- bearerAuth: []
- sessionCookie: []
paths:
/working-time-models:
$ref: 'paths/working-time.yaml#/workingTimeModels'
/working-time-models/{id}:
$ref: 'paths/working-time.yaml#/workingTimeModelById'
A path file has one top-level key per path item, with its operations. A component file has a top-level schemas
key. Shared parts come from adsum-.
Operations
Every operation has an operation and an x- list (see Navigation and Access). The list
operation of the working-time models, shortened:
workingTimeModels:
get:
operationId: listWorkingTimeModels
summary: List working-time models
x-access:
- anyEmployee
- hr
- admin
parameters:
- $ref: ../../../adsum-core/openapi/components/common.yaml#/parameters/CompanyId
- $ref: ../../../adsum-core/openapi/components/common.yaml#/parameters/Page
- $ref: ../../../adsum-core/openapi/components/common.yaml#/parameters/PerPage
- $ref: ../../../adsum-core/openapi/components/common.yaml#/parameters/Sort
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../components/working-time.yaml#/schemas/WorkingTimeModelList
'403':
$ref: ../../../adsum-core/openapi/components/common.yaml#/responses/Forbidden
Schemas
Reusable schemas of the core in common. include:
Uuid,Date,Date,Time TimeandOf Day Durationfor identifiers, dates, instants, wall-clock times and durationsSeconds Daysfor quantities of days in steps of 0.5LocaleandLocalised, an object with the propertiesText enanddeDayandReason Absence, the shared vocabularies of working-day calendar and absencesCategory List(Scope self,team,company)EmployeewithReference id,displayandName avatarUrl Pagefor paging andMeta ProblemandViolationfor errors
common. also holds the shared parameters (Company, Idempotency, If, Page,
Per, Sort, Facets, Id, Date, Date) and responses (Bad,
Unauthorized, Forbidden, Not, Conflict, Precondition, Precondition,
Unprocessable and others).
Conventions
All packages follow these conventions:
- JSON property names are camelCase.
- Identifiers are UUIDs (version 7) as strings.
- Calendar dates are ISO 8601 (
2026-). Instants are RFC 3339 with an offset (10- 01 2026-).10- 01T08: 15: 00+02: 00 - Durations are integer seconds in properties whose name ends in
Seconds. - Quantities of days are numbers in steps of 0.5.
- Errors are RFC 9457 problem details (
application/).problem+json
Collections
A list operation takes page (from 1), per (default 50, at most 200) and sort, a comma-separated
list of properties; a leading - sorts descending (sort=name,-). Filters are plain query parameters.
The response has the rows in items and the paging data in meta:
{
"items": [],
"meta": {"page": 1, "perPage": 50, "totalItems": 127}
}
A controller rejects undocumented query parameters with
Allowed. For filters named in the facets parameter,
meta. holds the number of rows per value.
Optimistic locking
Updatable resources answer with an ETag header. A change (PUT, PATCH or an action on the resource) sends
it in If-; without it the answer is 428, with an outdated value 412. A controller checks it with
Entity.
Idempotent creation
A POST marked with # can be retried with an Idempotency- header. The same key and body
within 24 hours return the original response; the same key with another body is rejected.
Errors
An exception becomes a problem response when its class carries #:
use WebVision\Adsum\Core\Shared\Api\Problem\AsProblem;
#[AsProblem(status: 409, type: 'working-time-model-code-taken', title: 'The company already has a working-time model with this code.')]
final class WorkingTimeModelCodeTakenException extends \DomainException {}
The response contains type (/problems/<type>), title, status, detail, code (the exception
code, for support and logs) and violations (field errors with property and message).
Controller
An API controller lives below src/<Module>/. It sets the route, declares the access and dispatches to the
command bus:
#[AsController]
#[Route('/api/v1/working-time-models')]
final readonly class WorkingTimeModelController
{
#[Route('', name: 'api_create_working_time_model', methods: ['POST'])]
#[Access('hr', 'admin')]
#[Idempotent]
public function create(Request $request, #[CurrentUser] User $author): JsonResponse
{
// validate the payload, dispatch the command, respond with 201 and Location
}
}
The # of each action equals the x- of its operation.