Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !3290

Bash skip empty query param fix

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/ccouzens/bash_query_param_fix into master Jul 06, 2019
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 56

Created by: ccouzens

Skip empty params when generating URLs

I have a route with many optional query parameters.
I observed that when they weren't specified, they were still included in
the routes, but without a value or the `&` character to separate them.

Running:
```bash
bash bash_keycloak/client.sh -v --oauth2-bearer "$access_token" --host "$api_host" --dry-run realmUsersGet realm=demo_realm2 email=foo+bar@baz.com username=foo
```

Would produce the route:
`http://localhost:8080/auth/admin/realms/demo_realm2/users?briefRepresentation=email=foo+bar@baz.comfirst=firstName=lastName=max=search=&username=foo`

After this change it produces the route:
`http://localhost:8080/auth/admin/realms/demo_realm2/users?email=foo+bar@baz.com&username=foo`

Note, I haven't written much bash, so I'm not yet used to its
conventions.

PR checklist

  • Read the contribution guidelines.

  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. Note that ./bin/bash-petstore.sh and ./bin/openapi3/bash-petstore.sh change the same files. I have committed with the output of ./bin/bash-petstore.sh.

  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.

  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @frol @bkryza @kenjones-cisco

Description of the PR

See above

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/ccouzens/bash_query_param_fix