cancel
Showing results for 
Search instead for 
Did you mean: 

Validation with Spectral fails `example` property type should be array

SOLVED
mariusBV
New Contributor

Validation with Spectral fails `example` property type should be array

Hello all,

 

bellow it's my OpenAPI specification that is failing when validation with Spectral because "`example` property type should be array".
I don't understand what is wrong with my example specification for an array of query parameters.

    put:
      callbacks: {}
      deprecated: false
      description: inviteUsers
      operationId: UserController.bulk_invite
      parameters:
        - description: list of User IDs to invite
          example: '?ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2&ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2'
          explode: true
          in: query
          name: 'ids[]'
          schema:
            items:
              description: id
              type: string
            type: array
          style: form

 Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
HKosova
Moderator

Re: Validation with Spectral fails `example` property type should be array

Replace

example: '?ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2&ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2'

with

example:
  - 58a45e20-6878-4e8f-9d7b-44622bc49bb2
  - 58a45e20-6878-4e8f-9d7b-44622bc49bb2

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

2 REPLIES 2
HKosova
Moderator

Re: Validation with Spectral fails `example` property type should be array

Replace

example: '?ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2&ids[]=58a45e20-6878-4e8f-9d7b-44622bc49bb2'

with

example:
  - 58a45e20-6878-4e8f-9d7b-44622bc49bb2
  - 58a45e20-6878-4e8f-9d7b-44622bc49bb2

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

mariusBV
New Contributor

Re: Validation with Spectral fails `example` property type should be array

Thank you very much 🙂

New Here?
Join us and watch the welcome video: