1

I have the following API definition in SwaggerHub:

swagger: '2.0'
info:
  description: defaultDescription
  version: '0.1'
  title: defaultTitle
host: swapi.co
paths:
  /api/people:
    get:
      produces:
        - application/json
      parameters:
        - name: search
          in: query
          required: false
          type: string
          x-example: luke
      responses:
        '200':
          description: Definition generated from Swagger Inspector
          schema:
            $ref: '#/definitions/Model0'
          responseSchema:
            $ref: '#/definitions/Model0'
definitions:
  Results:
    properties:
      name:
        type: string
      height:
        type: string
      mass:
        type: string
      hair_color:
        type: string
      skin_color:
        type: string
      eye_color:
        type: string
      birth_year:
        type: string
      gender:
        type: string
      homeworld:
        type: string
      films:
        type: array
        items:
          type: string
      species:
        type: array
        items:
          type: string
      vehicles:
        type: array
        items:
          type: string
      starships:
        type: array
        items:
          type: string
      created:
        type: string
      edited:
        type: string
      url:
        type: string
  Model0:
    properties:
      count:
        type: integer
        format: int32
      next:
        type: object
      previous:
        type: object
      results:
        type: array
        items:
          $ref: '#/definitions/Results'

I cannot make this basic GET command to bring back the data I'm seeking. It only returns this:

TypeError: Failed to fetch

I'm unsure if it's a syntax issue, or possibly spacing, but I'm also getting an error for line 19 that reads:

should NOT have additional properties additionalProperty: responseSchema, description, schema

Any ideas what is wrong?

2
  • What tool do you use to make the API calls? Swagger Editor/Swagger UI? Commented Jun 28, 2018 at 19:10
  • I'm using both through SwaggerHub. It's a split display. Commented Jun 29, 2018 at 11:35

1 Answer 1

1

https://swapi.co seems to be HTTPS-only, so you need to add

schemes:
  - https

to you API definition to specify the protocol for requests.


but I'm also getting an error for line 19 that reads: "should NOT have additional properties additionalProperty: responseSchema, description, schema".

Remove these lines:

          responseSchema:
            $ref: '#/definitions/Model0'

There's no responseSchema keyword in OpenAPI.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.