Skip to content

[O2B-1623] Document the run types endpoints in the HTTP API documentation - #2267

Merged
graduta merged 5 commits into
mainfrom
feature/O2B-1623/docs-run-types-endpoints
Oct 22, 2026
Merged

graduta merged 5 commits into
mainfrom
feature/O2B-1623/docs-run-types-endpoints

Conversation

@graduta

@graduta graduta commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Part of a stack of PRs documenting the HTTP API (O2B-1623). The earlier PRs of the stack are merged: this one is rebased on main and regenerated with the current generator. The following PRs of the stack are rebased one by one, once the previous one is merged.

Notable changes for users:

  • The 404 of GET /api/runTypes/{runTypeId} changes from { status: '404', title: 'Run with this id (X) could not be found' } to { status: 404, title: 'Not found', detail: 'Run type with this id (X) could not be found' } (same shape as the other service based endpoints; the old title wrongly said "Run").
  • createdAt and updatedAt are no longer sent for run types, including the runType of runs (breaking for any external client reading them).
  • GET /api/runTypes is no longer paginated: page[limit] / page[offset] are rejected (400) and meta.page is no longer returned (breaking for clients using them). Nothing in the GUI used them.
  • The run types endpoints are now documented at /api-docs, with parameters, responses and curl examples:
    • GET /api/runTypes: list of run types (ordered by name, descending, not paginated)
    • GET /api/runTypes/{runTypeId}: one run type

Notable changes for developers:

  • GetAllRunTypesUseCase and GetRunTypeUseCase are replaced by a RunTypeService (getAll, getOneOrFail) following the usual convention: the service applies the adapter and the query defaults on top of small functions returning models, the existing getRunTypeOrFail and a new getAllRunTypes(qbConfiguration) (like DetectorService with getAllDetectors). The lib/usecases/runType folder and its tests are removed; RunTypeService tests and a 404 API test are added.
  • Run types can be created automatically (a run created with a new run type name), so GetAllRunTypesUseCase still caps the query to ApiConfig.pagination.limit (5000 by default), which is what bounded the endpoint when no limit was given. The limit/offset handling, findAndCountAll and the meta computation are removed; the DTO no longer accepts page.
  • RunTypeAdapter.toEntity no longer returns createdAt and updatedAt: nothing uses them (the GUI only reads id and name, no test checks them). The adapter is used by the run types endpoints and by RunAdapter for the runType of a run, so the runType object of runs (/api/runs, run details...) loses the two fields too. The RunType typedef is updated and the API tests check the returned keys.
  • lib/server/api-docs/openapi.yaml is updated by hand, API.md and index.html are regenerated with npm run docs:api (separate commit).

Changes made to the database:

  • None

🤖 Generated with Claude Code

@graduta
graduta requested a review from isaachilly as a code owner October 20, 2026 12:58
@graduta
graduta added this pull request to stack #2265 October 20, 2026 12:58
@graduta graduta changed the title feature/O2B 1623/docs run types endpoints [O2B-1623] Document the run types endpoints in the HTTP API documentation Oct 20, 2026
@graduta graduta added documentation Improvements or additions to documentation backend labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.36%. Comparing base (4cf8635) to head (136dfdc).

Files with missing lines Patch % Lines
lib/server/controllers/runTypes.controller.js 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2267      +/-   ##
==========================================
+ Coverage   46.34%   46.36%   +0.01%     
==========================================
  Files        1050     1049       -1     
  Lines       17367    17351      -16     
  Branches     3168     3160       -8     
==========================================
- Hits         8049     8044       -5     
+ Misses       9318     9307      -11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graduta
graduta force-pushed the feature/O2B-1623/docs-run-types-endpoints branch from 29d7093 to cfcc343 Compare October 22, 2026 09:28
@graduta
graduta removed this pull request from stack #2265 October 22, 2026 09:29
@graduta
graduta changed the base branch from feature/O2B-1623/docs-dpl-detectors-endpoint to main October 22, 2026 09:29
@graduta
graduta added this pull request to stack #2276 October 22, 2026 09:30
Nothing uses the creation and update dates of run types: the GUI only reads the id and the name (`runTypesProvider`, run types overview and the `runType` of runs),
no test checks them, and `RunTypeAdapter.toEntity` is only used by the run types endpoints and by `RunAdapter` for the `runType` of a run. The adapter now only
returns `id` and `name`, so the `runType` of runs loses them too. The `RunType` typedef is updated and the API tests check the returned keys.
@graduta
graduta force-pushed the feature/O2B-1623/docs-run-types-endpoints branch from cfcc343 to 4003615 Compare October 22, 2026 09:34
The frontend never gives pagination parameters to `GET /api/runTypes` and never reads `meta`, and there are only a handful of run types (as for detectors and
tags, which are not paginated either). `page[limit]` and `page[offset]` are removed from the DTO and `meta.page` from the response.

Run types can be created automatically (when a run is created with a new run type name), so the use case still caps the query to `ApiConfig.pagination.limit` as
before, which is what protected the endpoint when no `limit` was given.

Breaking for clients giving `page[...]` parameters (rejected with a 400) or reading `meta`.
@graduta
graduta force-pushed the feature/O2B-1623/docs-run-types-endpoints branch 2 times, most recently from e7bdd0f to 8821a77 Compare October 22, 2026 09:46
`GetAllRunTypesUseCase` and `GetRunTypeUseCase` are replaced by a `RunTypeService` (`getAll` and `getOneOrFail`) like the other resources read through services
(detectors, simulation passes...). The service reuses `getRunTypeOrFail` which already existed, instead of duplicating the lookup in a use case, and keeps the cap
of `getAll` to `ApiConfig.pagination.limit`.

The 404 of `GET /api/runTypes/:runTypeId` is now sent from the `NotFoundError` like the other service based endpoints: it changes from
`{ status: '404', title: 'Run with this id (X) could not be found' }` (which wrongly said "Run") to
`{ status: 404, title: 'Not found', detail: 'Run type with this id (X) could not be found' }`.

The use case tests are replaced by `RunTypeService` tests and a 404 API test is added.
…tion

Also add the reusable PageLimit and PageOffset parameters and the PageMeta schema, to be used by the paginated endpoints documented next.
@graduta
graduta force-pushed the feature/O2B-1623/docs-run-types-endpoints branch from 8821a77 to 136dfdc Compare October 22, 2026 09:56
@graduta
graduta merged commit 19720a1 into main Oct 22, 2026
44 of 45 checks passed
@graduta
graduta deleted the feature/O2B-1623/docs-run-types-endpoints branch October 22, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

2 participants