0

Hello I'm attempting to create a array of objects in swagger hub

However I seem to be getting an error for seemingly no reason

LocationGetAllResponse:
  properties:
    type: array
    items: 
      $ref: '#/components/schemas/LocationObject'


LocationObject:
  type: object
  properties:
    longitude:
      type: number
      example: 1
    latitude:
      type: number
      example: 2
    altitude:
      type: number
      example: 

I modelled it after the official docs https://swagger.io/docs/specification/data-models/data-types/#array

However the error I'm getting is

Structural error at components.schemas.LocationGetAllResponse.properties.type

should be object

Basically at the type:array its saying it should be an object

Any help would be appreciated

1 Answer 1

1

Just remove "properties:":

LocationGetAllResponse:
  type: array
  items: 
    $ref: '#/components/schemas/LocationObject'
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.