Skip to content

OpenAPI: GET /v1/customer/{id} response shape drift (bare Customer vs envelope) #312

@CryptoJones

Description

@CryptoJones

The OpenAPI spec for GET /v1/customer/{id} declares the 200 body as $ref: '#/components/schemas/Customer' — a bare row. The controller actually returns:

```json
{
"message": "Successfully retrieved the customer with CustomerId N",
"customer": { ... },
"customers": { ... }
}
```

The dual key (customer singular + customers plural backward-compat wart) is documented in customercontroller.js's findAndRespond. SDK generators reading the spec build a client expecting the bare row, then fail to find fields at runtime because they live one level deeper.

Also: the controller emits 404 on a missing row but the spec doesn't document that response, so SDK code-gen has no branch for it.

Fix: update the spec to describe the envelope shape + add the 404 entry. Pin both with a test.

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions