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
  • Issues
  • #6954
Closed
Open
Issue created Jul 16, 2020 by Administrator@rootContributor2 of 6 checklist items completed2/6 checklist items

[BUG][Java][jersey2] Incorrect serialization of HTTP GET request body

Created by: sebastien-rosset

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When a HTTP message digest needs to be calculated for inclusion in a HTTP signature, the serializeToString() helper function is invoked to serialize the HTTP body, then that serialized value is used to calculate a cryptographic hash of the body, which is set in the Digest header. There are several use cases:

  1. The body is not set (obj argument is null). For example, HTTP GET requests must have an empty body.
  2. The body is set to the empty string. For example a HTTP POST request where the body is the empty string.
  3. The body is the JSON value null. For example, a HTTP POST request body may contain the JSON null value.
  4. The body is the JSON string "null". For example, a HTTP POST request body may contain the JSON "null" value.
  5. The body is some other non-null value.

For use case (1), the serializeToString() function incorrectly returns the String null. Instead the function should return the empty string "". Note: in the case of HTTP GET, the isBodyNullable argument is false and the obj argument is null.

openapi-generator version

master July 15 2020

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix

I had opened a PR earlier: https://github.com/OpenAPITools/openapi-generator/pull/6634, it was properly handling the HTTP GET case, but the code has diverged since then.

Assignee
Assign to
Time tracking