Skip to content

Commit 1a807dd

Browse files
committed
Add validation endpoint
1 parent 88cbf8d commit 1a807dd

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

src/main/resources/openapi.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@ paths:
103103
"404":
104104
description: Accession not found
105105

106+
/validate:
107+
post:
108+
summary: Validate a single MassBank record.
109+
requestBody:
110+
required: true
111+
content:
112+
text/plain; charset=utf-8:
113+
schema:
114+
type: string
115+
example: |
116+
ACCESSION: MSBNK-IPB_Halle-PB001341
117+
RECORD_TITLE: ...
118+
responses:
119+
"200":
120+
description: Record is valid.
121+
"400":
122+
description: Invalid request body (e.g. empty or not text).
123+
"422":
124+
description: Validation failed with details.
125+
content:
126+
application/json:
127+
schema:
128+
$ref: "#/components/schemas/validation_error"
129+
106130
components:
107131
schemas:
108132
record_list:
@@ -133,4 +157,18 @@ components:
133157
record_list:
134158
$ref: "#/components/schemas/record_list"
135159
format:
136-
$ref: "#/components/schemas/format"
160+
$ref: "#/components/schemas/format"
161+
162+
validation_error:
163+
description: Detailed validation errors for an invalid record.
164+
type: object
165+
properties:
166+
message:
167+
type: string
168+
example: Error message.
169+
line:
170+
type: integer
171+
example: 12
172+
column:
173+
type: integer
174+
example: 5

0 commit comments

Comments
 (0)