Skip to content

PUT /api/v1/pipelines/:id declares a flat body but reads a nested one #8583

Closed

Description

@cstns

PUT /api/v1/pipelines/:pipelineId declares a flat body:

body: {
    type: 'object',
    properties: {
        name: { type: 'string' }
    }
}

but the handler reads a nested one:

const reqName = request.body.pipeline.name?.trim()

So following the published schema fails:

PUT /api/v1/pipelines/:id   {"name":"flat rename"}
500 {"code":"unexpected_error","error":"TypeError: Cannot read properties of undefined (reading 'name')"}

while the undocumented shape works:

PUT /api/v1/pipelines/:id   {"pipeline":{"name":"nested rename"}}
200 {"id":"...","name":"nested rename","stages":[]}

The route's own tests use the nested shape, so the handler is probably what's intended and the schema is what's wrong. Either way the two disagree, anything generated from the OpenAPI spec will send the flat shape, and the failure is a 500 carrying a raw TypeError rather than a 400.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiWork on the platform APItype:bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions