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
  • #6779
Closed
Open
Issue created Jun 25, 2020 by Administrator@rootContributor

[BUG][JAVA] Content type of response seems to be ignored and always set to application/json

Created by: TimFaehrtBahn

Description

The defined content type within the open api spec seems to be ignored. The generated code always contains "application/json".

openapi-generator version

openapi-generator-cli-4.3.1.jar

OpenAPI declaration file content or url
[...]
 "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "description": "Controls whether and how long response can be cached by consumers, defaults to 'no-cache, no-store'.",
                "style": "simple",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/vnd.de.db.ris+json": {
                "schema": {
                  "$ref": "#/components/schemas/BoardPublicArrival"
                }
              }
            }
          }
[...]

##### Command line used for generation

java -jar openapi-generator-cli-4.3.1.jar generate -g java -i swagger.yml --library native --api-package innoapi.api --invoker-package innoapi.invoker --model-package innoapi.model

##### Steps to reproduce
Look in the code and the accept header.
`
localVarRequestBuilder.header("Accept", "application/json");
`

##### Related issues/PRs
/

##### Suggest a fix
Content type has to evaulated for setting the accept header.
Assignee
Assign to
Time tracking