0

This is the 'users' query parameter I want to pass as request:

    "users": [
        {
            "email": "sample",
            "password": "sample",
            "contact": {
                "first_name": "sample",
                "last_name": "sample",
                "phone_number": "sample",
                "gender": sample,
            }
        }
    ]

In swagger documentation, this is what I've put it:

      parameters:
        - name: users
          in: query
          required: true
          schema:
            type: array
            items:
              type: object
              properties:
                email:
                  type: string
                password:
                  type: string
                  format: password
                contact:
                  type: object
                  properties:
                    first_name:
                      type: string
                    last_name:
                      type: string
                    phone_number: 
                      type: string
                    gender:
                      type: integer

This is the error in laravel after executing the api:

{
  "message": "array_search() expects parameter 2 to be array, string given",
  "status_code": 500
}
RaedN
  • 13
  • 4
  • As explained in the [linked Q&A](https://stackoverflow.com/a/52894157/113116), query parameters containing an _array of objects_ are not yet supported by the OpenAPI Specification. If you are designing a new API (rather than documenting an existing one), consider passing this array in the POST body instead,. – Helen Mar 11 '21 at 11:30
  • Thank you Helen – RaedN Mar 11 '21 at 23:41

0 Answers0