apicollective / apibuilder

Simple, Comprehensive Tooling for Modern APIs
https://www.apibuilder.io/
MIT License
565 stars 83 forks source link

Swagger: Path definition ignored silently if no 200 response defined #851

Open barryoneill opened 3 years ago

barryoneill commented 3 years ago

When importing swagger definitions, if there is no 200 response defined on a path, that path's definition will be silently ignored on import.

In the example below, I have a GET endpoint that returns a 202 status. This endpoint is ignored. When I change this to (or add a) 200 response definition, the service is created.

swagger: '2.0'
info:
  title: BARRYTEST
  version: '1.0'
paths:
  /ping/{id}:
    get:
      description: a ping endpoint
      produces:
        - application/json
      parameters:
        - in: query
          name: id
          description: 'the resource to ping'
          type: string
          required: true
      responses:
        202:
          description: ping accepted
          schema:
            # must be a ref- https://github.com/apicollective/apibuilder/issues/594
            $ref: '#/definitions/PingResponse'
definitions:
  PingResponse:
    type: object
    properties:
      message:
        type: string
        description: miaow