From d729e33adec926bbceb419851827e47200bc968a Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Mon, 11 Apr 2022 14:32:32 -0500 Subject: [PATCH 1/5] Add missing schemas to swagger.yaml. A couple of the API endpoints were missing the `schema` tag, causing failure in processing by openapi-generator. --- src/main/resources/docs/swagger.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/resources/docs/swagger.yaml b/src/main/resources/docs/swagger.yaml index 8cc2b5f..9feda39 100644 --- a/src/main/resources/docs/swagger.yaml +++ b/src/main/resources/docs/swagger.yaml @@ -27,6 +27,10 @@ paths: description: knowledgebase names content: application/json: + schema: + type: array + items: + type: string examples: response: value: @@ -52,6 +56,15 @@ paths: description: KB info content: application/json: + schema: + type: object + properties: + isConsistent: + type: boolean + label: + type: string + logicalAxiomsCount: + type: integer examples: response: value: From fb6f25683583eaf5800964b777ae82a04ab41d23 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Mon, 11 Apr 2022 17:02:25 -0500 Subject: [PATCH 2/5] Add schema and docs for prefix map. Note that this makes [pull request 136](https://github.com/phenoscape/owlery/pull/136) obsolete. --- src/main/resources/docs/swagger.yaml | 37 +++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/resources/docs/swagger.yaml b/src/main/resources/docs/swagger.yaml index 9feda39..dc11f16 100644 --- a/src/main/resources/docs/swagger.yaml +++ b/src/main/resources/docs/swagger.yaml @@ -107,9 +107,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 @@ -198,9 +196,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 @@ -289,9 +285,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 @@ -365,9 +359,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' responses: '200': description: satisfiability @@ -409,8 +401,7 @@ paths: description: JSON format prefix map required: false schema: - type: string - format: JSON + $ref: '#/components/schemas/prefixMap' - name: direct in: query required: false @@ -461,8 +452,7 @@ paths: description: JSON format prefix map required: false schema: - type: string - format: JSON + $ref: '#/components/schemas/prefixMap' - name: direct in: query required: false @@ -613,4 +603,17 @@ paths: '200': description: SPARQL results 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"}' + From 132f8d9fd0e004073fda34957672cffec74f87fe Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 12 Apr 2022 09:19:13 -0500 Subject: [PATCH 3/5] Add action validating OpenAPI (swagger) spec. Adapted action from this posting: https://swagger.io/blog/api-design/validate-openapi-definitions-swagger-editor/ --- .github/workflows/api-spec.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/api-spec.yml diff --git a/.github/workflows/api-spec.yml b/.github/workflows/api-spec.yml new file mode 100644 index 0000000..e1cc8cc --- /dev/null +++ b/.github/workflows/api-spec.yml @@ -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 From d2ff28d44b35d7630b46c642ef7ce10f7f1ed943 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 12 Apr 2022 09:22:08 -0500 Subject: [PATCH 4/5] Disable broken docker-image GitHub action. --- .github/workflows/{ => disabled}/docker-image.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ => disabled}/docker-image.yml (100%) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/disabled/docker-image.yml similarity index 100% rename from .github/workflows/docker-image.yml rename to .github/workflows/disabled/docker-image.yml From a2d0fff59c5b1babcae80e78f8066299beb67633 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Wed, 13 Apr 2022 10:14:39 -0500 Subject: [PATCH 5/5] Add schemas for remaining responses. --- src/main/resources/docs/swagger.yaml | 128 ++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 14 deletions(-) diff --git a/src/main/resources/docs/swagger.yaml b/src/main/resources/docs/swagger.yaml index dc11f16..033f187 100644 --- a/src/main/resources/docs/swagger.yaml +++ b/src/main/resources/docs/swagger.yaml @@ -57,20 +57,14 @@ paths: content: application/json: schema: - type: object - properties: - isConsistent: - type: boolean - label: - type: string - logicalAxiomsCount: - type: integer + $ref: "#/components/schemas/kbInfo" examples: response: value: label: uberon isConsistent: true logicalAxiomsCount: 43938 + "/kbs/{kb}/subclasses": get: tags: @@ -103,7 +97,8 @@ 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: @@ -141,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: @@ -230,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: @@ -304,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: @@ -365,6 +418,19 @@ paths: 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: @@ -420,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: @@ -509,7 +586,9 @@ paths: '200': description: SPARQL results content: - application/sparql-results+xml: {} + application/sparql-results+xml: + schema: + type: string post: tags: - SPARQL @@ -530,7 +609,7 @@ 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: @@ -538,12 +617,16 @@ paths: 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: @@ -568,7 +651,9 @@ paths: '200': description: Expanded SPARQL query content: - application/sparql-query: {} + application/sparql-query: + schema: + type: string post: tags: - SPARQL @@ -602,6 +687,10 @@ paths: responses: '200': description: SPARQL results + content: + application/json: + schema: + type: string components: schemas: prefixMap: @@ -616,4 +705,15 @@ components: 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