zero-rails_openapi icon indicating copy to clipboard operation
zero-rails_openapi copied to clipboard

Document parameter options outside of Schema object

Open macfanatic opened this issue 3 years ago • 2 comments

Attempting to provide more specifications on the parameter object itself, such as style or explode seems impossible right now, as any options provided are nested under the schema object itself.

Is there a way to achieve this? I feel like we would need an additional method parameter to capture this information separately from the schema options itself.

Proposed possibility:

api :index do
  query! :'client_ids[]', Array[Integer], { uniqueItems: true }, style: :form, explode: true
end

Right now using 3 arguments and passing style: :form, explode: true along with the uniqueItems: true just results as those being nested incorrectly:

Generated, incorrect

{
  "name": "client_ids[]",
  "in": "query",
  "required": true,
  "schema": {
    "type": "array",
    "uniqueItems": true,
    "explode": true,
    "style": "form",
    "items": {
      "type": "integer"
    }
  }
}

Desired

{
  "name": "client_ids[]",
  "in": "query",
  "required": true,
  "explode": true,
  "style": "form",
  "schema": {
    "type": "array",
    "uniqueItems": true,
    "items": {
      "type": "integer"
    }
  }
}

macfanatic avatar Feb 04 '21 17:02 macfanatic

Some ideas of how to deal with that can be borrowed here.

bopm avatar Aug 16 '21 19:08 bopm

I've updated my PR to include your case.

bopm avatar Aug 17 '21 12:08 bopm