Skip to content

fix(crud): support distinct getResponseSchema for detail endpoints#12

Merged
caballeto merged 1 commit intomainfrom
fix/incident-detail-response-schema
Apr 21, 2026
Merged

fix(crud): support distinct getResponseSchema for detail endpoints#12
caballeto merged 1 commit intomainfrom
fix/incident-detail-response-schema

Conversation

@caballeto
Copy link
Copy Markdown
Contributor

Summary

GET /api/v1/incidents/{id} returns the full IncidentDetailDto
envelope ({incident, updates, statusPageIncidents}), not the flat
IncidentDto returned by GET /api/v1/incidents. The strict response
validator was rejecting valid detail responses with:

ValidationError: GET /api/v1/incidents/<id>: invalid SingleValueResponse envelope
  (data.id: Required; data.organizationId: Required; ...
   data: Unrecognized key(s) in object: 'incident', 'updates', 'statusPageIncidents')

This was caught by the monorepo's surface-integration suite
(tests/surfaces/cli/test_incidents.py::TestIncidentsCRUD::test_create_resolve_delete)
on PR devhelmhq/mono#246.

Fix

Mirror the existing createResponseSchema pattern: add an optional
getResponseSchema to ResourceConfig that defaults to
responseSchema, and wire it into the INCIDENTS resource so:

  • list still validates against IncidentDto
  • get and create validate against IncidentDetailDto

No behaviour change for any other resource (default fall-through
preserves the strict envelope used everywhere else).

Test plan

  • npm run typecheck
  • npm test (856 unit tests pass)
  • Verified locally with the test API: incidents create → get → resolve → delete flow now passes end-to-end against mono test stack
  • Surface integration tests make test-surface SURFACE=cli (303 passed, 1 skipped) — green when paired with this branch

Made with Cursor

GET /api/v1/incidents/{id} returns IncidentDetailDto (with updates +
status-page incidents), not the flat IncidentDto. The single
responseSchema was rejecting valid responses with a strict envelope
validation error.

Mirror the createResponseSchema pattern: add an optional
getResponseSchema that defaults to responseSchema, and wire it into
INCIDENTS so list still validates against IncidentDto while get
validates against the wider detail DTO.

Made-with: Cursor
@caballeto caballeto merged commit 47070ca into main Apr 21, 2026
3 checks passed
@caballeto caballeto deleted the fix/incident-detail-response-schema branch April 21, 2026 15:51
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.

1 participant