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
  • #2606
Closed
Open
Issue created Apr 05, 2019 by Administrator@rootContributor

[BUG] [Spring] example response uses platform default charset

Created by: brabster

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

SpotBugs reports an issue with the ApiUtil class - reliance on default encoding

openapi-generator version

3.3.4

OpenAPI declaration file content or url

This is in ApiUtil, so I suspect it is present in any generated API server.

Command line used for generation

Maven plugin:

                          <generatorName>spring</generatorName>
                          <configOptions>
                                <sourceFolder>src/gen/java/main</sourceFolder>
                                <java8>true</java8>
                                <reactive>true</reactive>
                                <apiPackage>foo.bar.api</apiPackage>
                                <modelPackage>foo,bar.model</modelPackage>
                                <delegatePattern>true</delegatePattern>
                            </configOptions>
Steps to reproduce

Generate the api (mvn compile)

Related issues/PRs

None that I can see

Suggest a fix

I think the issue is here: https://github.com/OpenAPITools/openapi-generator/blob/68a8f2976cd0bf7af67d7568bfbba84d689cc6b2/modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache#L30

I see UTF-8 used elsewhere, so I think the call to String.getBytes should specify the UTF-8 Charset.

Assignee
Assign to
Time tracking