Skip to content

Instantly share code, notes, and snippets.

@tfuji
Created September 7, 2020 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfuji/939768ba662c513a077fae569851e244 to your computer and use it in GitHub Desktop.
Save tfuji/939768ba662c513a077fae569851e244 to your computer and use it in GitHub Desktop.
Converted the openapi specification from 2.0 to 3.0. https://ddbj.nig.ac.jp/api/apispec/ddbjapi.json
openapi: 3.0.0
info:
title: DDBJ Data Validation API
description: DDBJ Data Validation API
version: 0.9.0
paths:
/validation:
post:
tags:
- Validation
summary: execute validation
description: Create a new validation job
operationId: validation
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
submission:
description: Upload DRA submission XML file.
type: string
format: binary
bioproject:
description: Upload BioProject XML file.
type: string
format: binary
biosample:
description: Upload BioSample XML file.
type: string
format: binary
expreriment:
description: Upload DRA expreriment XML file.
type: string
format: binary
run:
description: Upload DRA run XML file.
type: string
format: binary
analysis:
description: Upload DRA analysis XML file.
type: string
format: binary
responses:
"200":
description: Successful Operation
content:
application/json:
schema:
$ref: "#/components/schemas/Status"
ok:
examples:
response:
value:
uuid: 27ca0fbf-88a9-49c5-96f6-f3dfd257888f
status: accepted
start_time: 2017-08-29 21:15:53 +0900
"400":
description: Bad Request. Invalid input file supplied.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
invalid file combination:
examples:
response:
value:
status: error
message: Invalid combination of files
"/validation/{uuid}/status":
get:
tags:
- Validation
summary: validation status
description: Get specific validation status
parameters:
- $ref: "#/components/parameters/uuid"
responses:
"200":
description: Successful Operation
content:
application/json:
schema:
$ref: "#/components/schemas/Status"
finished:
examples:
response:
value:
uuid: 27ca0fbf-88a9-49c5-96f6-f3dfd257888f
status: finished
start_time: 2017-08-29 21:15:53 +0900
end_time: 2017-08-29 21:16:03 +0900
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
not exist UUID:
examples:
response:
value:
status: error
message: Invalid UUID
"/validation/{uuid}":
get:
tags:
- Validation
summary: validation result
description: Get specific validation result
parameters:
- $ref: "#/components/parameters/uuid"
responses:
"200":
description: Successful Operation
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationResult"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
error occurred while executing the validation process:
examples:
response:
value:
status: error
message: Failed the sparql query
not exist UUID:
examples:
response:
value:
status: error
message: Invalid UUID
unfinished UUID:
examples:
response:
value:
status: error
message: This validation job has not completed yet
"/validation/{uuid}/{filetype}":
get:
tags:
- Validation
summary: validation original file
description: Get the original file of specific validation
parameters:
- $ref: "#/components/parameters/uuid"
- $ref: "#/components/parameters/filetype"
responses:
"200":
description: An original xml file validated
content:
application/xml:
schema:
type: string
format: binary
"400":
description: Bad Request
content:
application/xml:
schema:
$ref: "#/components/schemas/Error"
not exist UUID:
examples:
response:
value:
status: error
message: Invalid UUID
invalid filetype:
examples:
response:
value:
status: error
message: Invalid or not exist filetype.
"/validation/{uuid}/{filetype}/autocorrect":
get:
tags:
- Validation
summary: validation autocorrected file
description: Get the autocorrected file of specific validation
parameters:
- $ref: "#/components/parameters/uuid"
- $ref: "#/components/parameters/filetype"
responses:
"200":
description: An autocorrected xml file
content:
application/xml:
schema:
type: string
format: binary
"400":
description: Bad Request
content:
application/xml:
schema:
$ref: "#/components/schemas/Error"
not exist UUID:
examples:
response:
value:
status: error
message: Invalid UUID
invalid filetype:
examples:
response:
value:
status: error
message: Invalid or not exist filetype.
no autocorrect fields:
examples:
response:
value:
status: error
message: not exist autocorrect fields on this validation.
"/submission/{filetype}/{submission_id}":
get:
tags:
- Validation
summary: download a submision XML file
description: Get the xml file of specific submission_id. This api for administrator
parameters:
- $ref: "#/components/parameters/filetype"
- $ref: "#/components/parameters/submission_id"
responses:
"200":
description: An xml file of specified submission_id
content:
application/xml:
schema:
type: string
format: binary
"400":
description: Bad Request
content:
application/xml:
schema:
$ref: "#/components/schemas/Error"
not exist UUID:
examples:
response:
value:
status: error
message: Invalid submission_id
invalid filetype:
examples:
response:
value:
status: error
message: Invalid or not exist filetype.
security:
- api_key: []
servers:
- url: https://ddbj.nig.ac.jp/api
components:
parameters:
uuid:
name: uuid
in: path
description: Unique identifier of Validation Job.
required: true
schema:
type: string
filetype:
name: filetype
in: path
description: filetype e.g., submission, biosample, bioproject, run,
required: true
schema:
type: string
submission_id:
name: submission_id
in: path
description: Unique identifier of Submission. Starts with 'SSUBXXXXXX', 'PSUBXXXXXX'
or 'submitter_id + serial'
required: true
schema:
type: string
securitySchemes:
api_key:
type: apiKey
in: header
name: api_key
schemas:
Status:
type: object
properties:
uuid:
type: string
status:
type: string
description: '"accepted" or "running" or "finished" or "error"'
start_time:
type: string
end_time:
type: string
description: only when status is "finished"
ValidationResult:
type: object
description: validation result file
properties:
uuid:
type: string
status:
type: string
description: only "finished"
start_time:
type: string
end_time:
type: string
result:
type: object
properties:
version:
type: string
description: api version
validity:
type: boolean
description: "true: passed the all validation rules
false: unpassed the
validation
if only warning will return true"
stats:
type: object
description: statistics of validation result
properties:
error_count:
type: integer
warning_count:
type: integer
autocorrect:
type: object
description: true is autocorrect file is exist
messages:
type: array
items:
$ref: "#/components/schemas/ValidationMessages"
example:
uuid: 27ca0fbf-88a9-49c5-96f6-f3dfd257888f
status: finished
start_time: 2017-08-29 21:15:53 +0900
end_time: 2017-08-29 21:16:03 +0900
result:
version: 0.9.0
validity: true
stats:
error_count: 0
warning_count: 2
autocorrect:
biosample: true
bioproject: false
messages:
- id: "14"
message: Not predefined attribute name.
level: warning
method: BioSample
object:
- BioSample
source: SSUB001664.xml
annotation:
- key: Sample name
value: DRS000302
- key: Attribute names
value: sample comment
- id: "7"
message: Invalid date format. An automatically-generated correction will
be applied.
level: warning
method: BioSample
object:
- BioSample
source: SSUB001664.xml
annotation:
- key: Sample name
value: DRS000302
- key: Attribute
value: collection_date
- key: Attribute value
value: 22-APR-2004
- key: Suggested value
suggested_value: 2004-04-22
target_key: Attribute value
location:
- //BioSample[1]/Attributes/Attribute[@attribute_name="collection_date"]
is_auto_annotation: true
ValidationMessages:
type: array
items:
type: object
properties:
method:
type: string
description: rule method
id:
type: integer
description: rule id
message:
type: string
description: error message
level:
type: string
description: '"warning" or "error"'
object:
type: array
items:
type: string
description: related object
source:
type: string
description: validated filename
annotation:
type: array
items:
properties:
key:
type: string
suggested_value:
type: string
is_auto_annotation:
type: boolean
description: if has auto_annotation
target_key:
type: string
description: if has auto_annotation. points other 'key' name
location:
type: array
items:
type: string
description: if has auto_annotation. list of xpath
Error:
type: object
properties:
status:
type: string
message:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment