feat: Add PUT and PATCH datasets endpoints

This commit is contained in:
2026-07-21 00:19:52 +05:00
parent 47b2e8653d
commit 00a0cd1b8e
5 changed files with 451 additions and 4 deletions

View File

@@ -268,6 +268,51 @@ paths:
schema: { $ref: "#/components/schemas/Dataset" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
put:
tags: [Datasets]
summary: Replace a dataset's editable metadata
description: |
Updates category, name, description, and unit. Every field is
required; the file, file type, and processing/lifecycle state are
never touched here. Sending an empty string for `description` or
`unit` clears that (optional) field.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetPut" }
responses:
"200":
description: Updated
content:
application/json:
schema: { $ref: "#/components/schemas/Dataset" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"422": { $ref: "#/components/responses/ValidationError" }
patch:
tags: [Datasets]
summary: Partially update a dataset's editable metadata
description: |
Updates only the fields present in the body, from category, name,
description, and unit. The file, file type, and processing/lifecycle
state are never touched here. Sending an explicit `null` for
`description` or `unit` clears that (optional) field; omitting a
field leaves it unchanged.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DatasetPatch" }
responses:
"200":
description: Updated
content:
application/json:
schema: { $ref: "#/components/schemas/Dataset" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"422": { $ref: "#/components/responses/ValidationError" }
delete:
tags: [Datasets]
summary: Delete a dataset
@@ -572,6 +617,41 @@ components:
type: string
maxLength: 2000
DatasetPut:
type: object
required: [category_id, name, description, unit]
properties:
category_id:
type: string
format: uuid
name:
type: string
maxLength: 255
description:
type: string
description: An empty string clears the field.
unit:
type: string
description: An empty string clears the field.
DatasetPatch:
type: object
description: At least one field is required. Omitted fields are left unchanged.
minProperties: 1
properties:
category_id:
type: string
format: uuid
name:
type: string
maxLength: 255
description:
type: [string, "null"]
description: null clears the field.
unit:
type: [string, "null"]
description: null clears the field.
AttributeColumn:
type: object
required: [name]