Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fix swagger.yaml and validate it in GitHub Actions #205

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/api-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Adapted from this posting:
# https://swagger.io/blog/api-design/validate-openapi-definitions-swagger-editor/

on:
push:
branches:
- '**'
pull_request:
branches:
- master
workflow_dispatch:


jobs:
test_swagger_editor_validator_remote:
runs-on: ubuntu-latest
name: Swagger Editor Validator Remote


steps:
- uses: actions/checkout@v2
- name: Validate OpenAPI definition
uses: char0n/swagger-editor-validate@v1
with:
definition-file: src/main/resources/docs/swagger.yaml
162 changes: 139 additions & 23 deletions src/main/resources/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ paths:
description: knowledgebase names
content:
application/json:
schema:
type: array
items:
type: string
examples:
response:
value:
Expand All @@ -52,12 +56,15 @@ paths:
description: KB info
content:
application/json:
schema:
$ref: "#/components/schemas/kbInfo"
examples:
response:
value:
label: uberon
isConsistent: true
logicalAxiomsCount: 43938

"/kbs/{kb}/subclasses":
get:
tags:
Expand Down Expand Up @@ -90,13 +97,12 @@ paths:
summary: an anonymous expression, using prefix definitions
- name: prefixes
in: query
description: JSON format prefix map, used to expand prefixes in the 'object'
description: >-
JSON format prefix map, used to expand prefixes in the 'object'
expression
required: false
schema:
type: string
format: JSON
example: '{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}'
$ref: '#/components/schemas/prefixMap'
- name: direct
in: query
required: false
Expand Down Expand Up @@ -130,6 +136,27 @@ paths:
description: subclasses
content:
application/json:
schema:
type: object
additionalProperties:
type: object
properties:
value:
type: object
properties:
"@id":
type: string
format: uri
superClassOf:
type: array
items:
type: string
format: uri
value:
type: string
required:
- "@id"
- superClassOf
examples:
named class:
value:
Expand Down Expand Up @@ -185,9 +212,7 @@ paths:
expression
required: false
schema:
type: string
format: JSON
example: '{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}'
$ref: '#/components/schemas/prefixMap'
- name: direct
in: query
required: false
Expand Down Expand Up @@ -221,6 +246,22 @@ paths:
description: superclasses
content:
application/json:
schema:
type: object
properties:
'@id':
type: string
format: uri
value:
type: string
subClassOf:
type: array
items:
type: string
format: uri
required:
- "@id"
- subClassOf
examples:
named class:
value:
Expand Down Expand Up @@ -276,9 +317,7 @@ paths:
expression
required: false
schema:
type: string
format: JSON
example: '{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}'
$ref: '#/components/schemas/prefixMap'
- name: direct
in: query
required: false
Expand All @@ -297,6 +336,27 @@ paths:
description: equivalent classes
content:
application/json:
schema:
type: object
additionalProperties:
type: object
properties:
value:
type: object
properties:
"@id":
type: string
format: uri
equivalentClass:
type: array
items:
type: string
format: uri
value:
type: string
required:
- "@id"
- equivalentClass
examples:
named class:
value:
Expand Down Expand Up @@ -352,14 +412,25 @@ paths:
expression
required: false
schema:
type: string
format: JSON
example: '{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}'
$ref: '#/components/schemas/prefixMap'
responses:
'200':
description: satisfiability
content:
application/json:
schema:
type: object
properties:
"@id":
type: string
format: uri
isSatisfiable:
type: boolean
value:
type: string
required:
- "@id"
- isSatisfiable
examples:
named class:
value:
Expand Down Expand Up @@ -396,8 +467,7 @@ paths:
description: JSON format prefix map
required: false
schema:
type: string
format: JSON
$ref: '#/components/schemas/prefixMap'
- name: direct
in: query
required: false
Expand All @@ -416,6 +486,17 @@ paths:
description: instances
content:
application/json:
schema:
type: object
properties:
"@id":
type: string
format: uri
hasInstance:
type: array
items:
type: string
format: uri
examples:
named class:
value:
Expand Down Expand Up @@ -448,8 +529,7 @@ paths:
description: JSON format prefix map
required: false
schema:
type: string
format: JSON
$ref: '#/components/schemas/prefixMap'
- name: direct
in: query
required: false
Expand Down Expand Up @@ -506,7 +586,9 @@ paths:
'200':
description: SPARQL results
content:
application/sparql-results+xml: {}
application/sparql-results+xml:
schema:
type: string
post:
tags:
- SPARQL
Expand All @@ -527,20 +609,24 @@ paths:
application/sparql-query:
schema:
type: string
format: SPARQL query
# format: SPARQL query
example: SELECT ?x WHERE { ?x a "blah"}
application/x-www-form-urlencoded:
schema:
type: object
properties:
query:
type: string
format: SPARQL query
# format: SPARQL query
required:
- query
responses:
'200':
description: SPARQL results
description: SPARQL results
content:
application/json:
schema:
type: string
"/kbs/{kb}/expand":
get:
tags:
Expand All @@ -565,7 +651,9 @@ paths:
'200':
description: Expanded SPARQL query
content:
application/sparql-query: {}
application/sparql-query:
schema:
type: string
post:
tags:
- SPARQL
Expand Down Expand Up @@ -599,5 +687,33 @@ paths:
responses:
'200':
description: SPARQL results
content:
application/json:
schema:
type: string
components:
schemas: {}
schemas:
prefixMap:
description: >
JSON format prefix map, used to expand prefixes in
the 'object' expression. A JSON format prefix map is a JSON
object whose keys are prefixes without the colon separator
(e.g., \"owl\"), and whose values are IRI prefixes
(typically WITH the hash-mark, \"#\" suffix). Because these
are passed as parameters, they may need to be URL-encoded to
pass over HTTP.
type: string
format: JSON
example: '{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}'
kbInfo:
description: >-
Information provided about a specific KB.
type: object
properties:
isConsistent:
type: boolean
label:
type: string
logicalAxiomsCount:
type: integer