Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][native] Properly encode exploded query params in url #11682

Merged

Conversation

sorin-florea
Copy link
Contributor

Fixes #4808 by properly setting exploded query params

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @wing328

@sorin-florea
Copy link
Contributor Author

@wing328 while using openapi-generator we tried to have a POJO generated out of query parameters defined in the openAPI specification using explode: true but it is not working properly, it seems like this has been broken for quite a while and it is a showstopper for us. Do you think this can be released in a patch version as we and others need it?

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608

@wing328
Copy link
Member

wing328 commented Feb 22, 2022

Do you think this can be released in a patch version as we and others need it?

Sorry I don't think so. You will need to wait for v6.0.0 release or use the customized templates for the time being.

@wing328 wing328 merged commit 7dcfe62 into OpenAPITools:master Feb 22, 2022
@Hollerweger
Copy link

I tested with 6.0.0-beta and I sill see the same issue with not exploded params in query url.
eg,;
http://localhost:54795/client?pageable=class%20Pageable%20%7B%0A%20%20%20%20page%3A%200%0A%20%20%20%20size%3A%201%0A%20%20%20%20sort%3A%20ASC%0A%20%20%20%20sortBy%3A%20null%0A%7D
instead of
http://localhost:54795/client?size=1&page=1

openapi: 3.0.3
paths:
  /client:
    get:
      tags:
        - client
      summary: Get list of Clients
      operationId: getClients
      parameters:
        - in: query
          name: pageable
          required: false
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '202':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientPage'
components:
  schemas:
    Pageable:
      type: object
      properties:
        page:
          type: integer
          default: 0
          minimum: 0
        size:
          type: integer
          default: 20
          minimum: 1
        sort:
          type: string
          enum:
            - ASC
            - DESC
          default: "ASC"
        sortBy:
          type: string

@sorin-florea
Copy link
Contributor Author

@Hollerweger This is a because the parameter is defined by $ref. I have this PR that addresses the issue.

@Hollerweger
Copy link

Thanks @sorin-florea !
Is there any workaround to define the paging parameters in a object to reference as query parameters in current 5.x.x release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] [JAVA] Using an object to pass query params ends up using the toString of that class
3 participants