rswag/rswag

[BUG] Referenced schemas for query params won't serialize as expected

andreacasarin opened this issue · 0 comments

Describe the bug

When describing an object to pass trough query params via referenced schema (in swagger_helper.rb) it won't serialize with the same style as it was described in the test case itself.

Steps to Test or Reproduce

Given let(:q) {{ name_eq: 'foo' }}:

      parameter name: :q, in: :query, schema: {
        type: :object,
        properties: {
          name_eq: { type: :string }
        }
      }

Will result in url/q[name_eq]=foo.

        schemas: {
          q: {
            type: :object,
            properties: {
              name_eq: { type: :string }
            }
          }
        }

        parameter name: :q, in: :query, style: :deepObject, schema: { '$ref' => '#/components/schemas/q' }

Will result in url?q={:name_eq=%3E%22foo%22}.

Expected behavior

They should both behave the first way as per Swagger docs: https://swagger.io/docs/specification/describing-parameters/#query-parameters and https://swagger.io/docs/specification/serialization/.

Dependency versions

Latest versions.

Relates to which version of OAS (OpenAPI Specification)

  • OAS2
  • OAS3
  • OAS3.1