BioContainers / biocontainers-backend

Python backend for Biocontainers (Flask + MongoDB)
http://biocontainers.pro
Apache License 2.0
3 stars 1 forks source link

OpenAPI schema invalid? #24

Open multimeric opened 4 years ago

multimeric commented 4 years ago

I've encountered a number of errors when trying to use the OpenAPI spec to create a client and then generate some requests. I think these errors are in the spec and also in the response sometimes not matching the spec. At the very least, I have identified this schema issue:

Error: One or more errors exist in the OpenApi definition
  at: components > schemas > Tool > properties
    at: contains
      Missing required property: items
    at: identifiers
      Missing required property: items

I've made a simple validation script for Node, that uses openapi-enforcer (run npm install openapi-enforcer beforehand), which produces the above output. I'll run it again if the API spec gets fixed in order to check if the responses are valid, but currently it's getting stuck at the invalid spec.

const Enforcer = require('openapi-enforcer')

Enforcer('https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json', { fullResult: true })
    .then(({error, value}) => {
        if (error){
            throw new Error(error);
        } else {
            return value.request({
              method: 'get',
              path: '/ga4gh/trs/v2/tools?toolClass=Docker&limit=1000&sort_field=id&sort_order=asc',
            })
        }
    }).then(({error, value}) => {
        if (error){
            throw new Error(error);
        } else {
            console.log(value);
        }
    }).catch(error => {
        console.log(error);
    })