mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2026-06-18 19:41:42 +00:00
Bumps org.openapitools:openapi-generator-maven-plugin from 7.22.0 to 7.23.0. --- updated-dependencies: - dependency-name: org.openapitools:openapi-generator-maven-plugin dependency-version: 7.23.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> |
||
|---|---|---|
| .. | ||
| src/main | ||
| pom.xml | ||
| README.md | ||
api
Source-of-truth for Dependency-Track's REST API v2, in OpenAPI v3.0 format.
The spec is split across many small files and assembled at build time by
openapi-generator, which produces JAX-RS interfaces and
Java DTOs.
The API draws inspiration from Zalando's RESTful API Guidelines. Conformance to those guidelines and to project conventions is enforced with spectral in CI:
make lint-openapi
Layout
src/main/openapi/
openapi.yaml # info, tags, security, top-level path bindings
shared/ # cross-resource components
parameters/
responses/
schemas/
resources/<resource>/ # one directory per API tag
<noun>[-<qualifier>].yaml # one file per URL (all methods for that path)
schemas/ # schemas owned by this resource
Resource directories map 1:1 to tags declared in openapi.yaml. A path file
under resources/<r>/ is referenced from openapi.yaml via a single $ref.
Conventions
- One file per URL. A path file holds all HTTP methods for one URL.
OpenAPI 3.0 only allows
$refat the PathItem level, not under individual methods. - Filenames are kebab-case.
- Schema basenames are globally unique across
**/schemas/**. The generated Java class name is derived from the filename stem, so collisions would silently drop a class. Enforced bymake lint-openapi. - Cross-resource
$refs only intoshared/. A path or schema underresources/<a>/may not reference files underresources/<b>/. Promote toshared/when reuse arises. - Tags. Every operation must declare exactly one tag, drawn from the
canonical list in
openapi.yaml. Enforced by spectral.
Adding an endpoint
- Decide which resource (tag) owns it. If new, add a tag entry to
openapi.yamland createresources/<resource>/. - Create the path file at
resources/<resource>/<noun>.yamlwith all of its HTTP methods. - Place new request/response schemas under
resources/<resource>/schemas/. Promote shared shapes toshared/schemas/. - Add the URL ↔ file mapping to
openapi.yaml'spaths:section. - Run
make lint-openapiandmake buildto verify.