RapiDoc icon indicating copy to clipboard operation
RapiDoc copied to clipboard

Query String which is an object is rendered as [object Object] instead of the actual object

Open ThaDaVos opened this issue 3 years ago • 2 comments

In query strings one can use query parameters as follows; param[a][b][c]=1 - to do this inside OpenAPI one defines the query parameter to be an object, the schema is rendered correctly but sadly the example is not as seen below:

Schema: image Example: image

This makes testing really cumbersome as one has to manually type it out

ThaDaVos avatar Aug 12 '22 14:08 ThaDaVos

can you provide an minimal sample spec for us to recreate this at our end for a quicker response

mrin9 avatar Aug 12 '22 19:08 mrin9

I think this basically happens when example is an object and not an string:

              examples:
                ok-response:
                  value:
                    message: Success
                    code: 200

This happen for all example types ( parameters, responses, etc )

This is rendered as [object Object], as an alternative, we can pass it as a json serialized string, but in that scenario it kind of break that schema says is an object.

rahpuser avatar Sep 14 '22 17:09 rahpuser

also worth noting that in Swagger-UI and in RapiDoc(9.3.3) query is generated differently(same OpenApi schema) when I fill Example for filter field with { "name": "Qwerty" }

Swagger: ?filter%5Bname%5D=Qwerty

Raipdoc: ?name=Qwerty

sample spec in my case:

"/api/v1/endpoint":
  get:
    summary: Sample endpoint
    parameters:
    - name: filter
      in: query
      description: Sample
      style: deepObject
      explode: true
      schema:
        properties:
          name:
            type: string
            example: someName
          is_active:
            type: boolean
            example: true

alamagus avatar Dec 16 '22 10:12 alamagus