swagger-api / swagger-api/swagger-codegen

Wrong dynamic query parameter names in spring

Open
#12,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello, I'm trying to generate dynamic query parameter names in spring boot, I'm trying to get this
https://example.com/api_v3/v3/filters?static_arg=smth&freeform_arg1=value1&freeform_arg2=value2

but instead generated url is
https://example.com/api_v3/v3/filters?static_arg=smth&applied_filters=class%20AppliedFilter%20%7B%0A%20%20%20%20%7Barg2%3Dvalue2%2C%20arg1%3Dvalue1%7D%0A%7D

Swagger-codegen version

3.0.55

Swagger declaration file content or url
  /api_v3/v3/filters:
    get:
      parameters:
        - $ref: '#/components/parameters/static_arg'
        - in: query
          name: applied_filters
          schema:
            $ref: "#/components/schemas/AppliedFilter"
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilterResponseV3'

components:

  schemas:
    AppliedFilter:
      type: object
      additionalProperties:
        type: string
Suggest a fix/enhancement

Maybe it's a wrong specification declaration, or a bug. Please, help!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied OpenAPI declaration for /api_v3/v3/filters and its AppliedFilter schema, then reproduce generation with Swagger Codegen 3.0.55 for Spring. Compare the generated request construction with the expected freeform_arg1 and freeform_arg2 query parameters; done means the generated URL uses those dynamic names instead of serializing AppliedFilter as applied_filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, spring-boot
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.