Skip to content

Correct response annotations that mis-describe actual API responses - #1234

Merged
donaldgray merged 5 commits into
developfrom
hygiene/mechanical-c1
Aug 5, 2026
Merged

Correct response annotations that mis-describe actual API responses#1234
donaldgray merged 5 commits into
developfrom
hygiene/mechanical-c1

Conversation

@tomcrane

@tomcrane tomcrane commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Corrects [ProducesResponseType] annotations that disagree with what the endpoints actually return. No behaviour change — no runtime code paths are touched; only the generated Swagger/OpenAPI documentation is affected. One commit per fix.

  • DeliveryChannelPoliciesController.DeleteDeliveryChannelPolicy was annotated 202 Accepted, but it uses HandleDelete, which returns 204 No Content on success.
  • SpaceController.DeleteSpace was annotated 200 OK with a Space body; it also uses HandleDelete and actually returns 204 No Content with an empty body.
  • ImageController annotated its error responses (on PUT, PATCH and the legacy POST — 13 annotations in total) as ProblemDetails, but the endpoints produce Hydra Error bodies via HydraProblem, like every other controller. These were the only ProblemDetails annotations in the API project; the OpenAPI contract was advertising the wrong error schema for the asset endpoints.
  • AdjunctsController.PutAdjunct was annotated 200-only returning HydraCollection<Adjunct>. It is an upsert — it returns 201 Created when the adjunct is new — and it deliberately returns a single Adjunct (adjuncts.Single().ToHydra(...)), never a collection. Now annotated 200 + 201, type Adjunct.
  • CustomerAdjunctsController.DeleteAdjuncts was annotated 404 for its failure case, but the no-matching-adjuncts path returns a 400 (HydraProblem("No adjuncts found", null, 400, ...)).

Builds clean against develop (0 errors).

🤖 Generated with Claude Code

tomcrane and others added 5 commits August 5, 2026 10:12
HandleDelete -> ConvertDeleteToHttp returns NoContent() = 204
(HydraController.cs:174); the 202 annotation was a lie. No behaviour
change. Hygiene-sprint mechanical track (cards SPA-08, XC-01).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DeleteSpace uses HandleDelete -> NoContent() = 204 with an empty body;
the annotation promised a Space body that never arrives. No behaviour
change. Hygiene-sprint mechanical track (cards SPA-09, XC-01).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All 13 ProblemDetails ProducesResponseType annotations (PUT, PATCH and
legacy POST) now declare typeof(Error), matching the actual HydraProblem
bodies and every other controller. These were the only ProblemDetails
annotations in API. No behaviour change. Hygiene-sprint mechanical
track (card XC-05).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PUT /adjuncts/{id} is an upsert returning 201 for a new adjunct, and
deliberately returns a single Adjunct (adjuncts.Single().ToHydra), never
a collection. Was annotated 200-only with HydraCollection<Adjunct>. No
behaviour change. Hygiene-sprint mechanical track (card XC-11).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The no-adjuncts-found path returns HydraProblem(..., 400, ...)
(CustomerAdjunctsController.cs:65), not 404. No behaviour change.
Hygiene-sprint mechanical track.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tomcrane tomcrane changed the title Hygiene mechanical Batch C1: response-annotation corrections (no behaviour change) Correct response annotations that mis-describe actual API responses Aug 5, 2026
@donaldgray
donaldgray marked this pull request as ready for review August 5, 2026 09:35
@donaldgray
donaldgray requested a review from a team as a code owner August 5, 2026 09:35
@donaldgray
donaldgray merged commit b63206b into develop Aug 5, 2026
2 checks passed
@donaldgray
donaldgray deleted the hygiene/mechanical-c1 branch August 5, 2026 09:37
tomcrane added a commit that referenced this pull request Aug 5, 2026
Session-0 ratification (2026-08-06), extending the rule PR #1234
started: every 4xx/5xx ProducesResponseType annotation declares
Type = typeof(Error), matching the HydraProblem bodies. 24 bare
error-status annotations across 9 controllers gain the type; three
controllers gain the Hydra.Model using. Annotations only - no wire
change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants