Skip to content

Oats requires the server directive #26

@glinton

Description

@glinton

A swagger definition is valid without this directive, but oats requires it.

Given the following swagger:

openapi: "3.0.0"
info:
  title: Stuff service
  version: 0.0.0
paths:
  /stuff:
    post:
      operationId: createStuff
      requestBody:
        description: thing
        content:
          application/json:
            schema:
              type: string
      responses:
        '204':
          description: No content

Oats returns the following error:

/src/node_modules/@influxdata/oats/dist/generate.js:32
            server: this.doc.servers[0].url,
                                    ^

TypeError: Cannot read property '0' of undefined
    at Generator.registerPathOperation (/src/node_modules/@influxdata/oats/dist/generate.js:32:37)
    at new Generator (/src/node_modules/@influxdata/oats/dist/generate.js:24:26)
    at generate (/src/node_modules/@influxdata/oats/dist/generate.js:219:23)
    at async Command.<anonymous> (/src/node_modules/@influxdata/oats/bin/oats:7:18)

Run with:

docker run -v ${PWD}:/test --entrypoint /src/node_modules/.bin/oats quay.io/influxdb/oats  /test/swagger.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions