Skip to content

Commit

Permalink
fix: add request body schema in update segment endpoint (#8085)
Browse files Browse the repository at this point in the history
https://linear.app/unleash/issue/2-2592/updateimprove-a-segment-via-api-call

Related to #7987

This does not make the endpoint necessarily better - It's still a PUT
that acts as a PUT in some ways (expects specific required fields to be
present, resets the project to `null` if it's not included in the body)
and a PATCH in others (ignores most fields if they're not included in
the body). We need to have a more in-depth discussion about developing
long-term strategies for our API and respective OpenAPI spec.

However this at least includes the proper schema for the request body,
which is slightly better than before.
  • Loading branch information
nunogois authored Sep 5, 2024
1 parent b1ce023 commit 7bfc8b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/features/segment/segment-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ export class SegmentsController extends Controller {
openApiService.validPath({
summary: 'Update segment by id',
description:
'Updates the content of the segment with the provided payload. Any fields not specified will be left untouched.',
'Updates the content of the segment with the provided payload. Requires `name` and `constraints` to be present. If `project` is not present, it will be set to `null`. Any other fields not specified will be left untouched.',
tags: ['Segments'],
operationId: 'updateSegment',
requestBody: createRequestSchema('upsertSegmentSchema'),
responses: {
204: emptyResponse,
...getStandardResponses(400, 401, 403, 409, 415),
Expand Down

0 comments on commit 7bfc8b2

Please sign in to comment.