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
  • #7322
Closed
Open
Issue created Aug 31, 2020 by Administrator@rootContributor

[BUG][Kotlin] The character '-' in request headers replaced with 'Minus'

Created by: ahreed304

Description

Header names defined in the api spec that contain dashes are generated incorrectly. 'x-application-name' generates as 'xMinusApplicationMinusName. This only happens when generating Kotin. If the same spec is used to generate Java code, it will appear correctly as 'xApplicationName'.

openapi-generator version

Using version 4.3.1. Also tried 5.0.0-beta with same results

OpenAPI declaration file content or url

The following excerpt of my .yml spec:

paths:
  /reload:
    parameters:
      - in: header
        name: x-application-name
        required: true
        description: "foo"
        example: "bar"
        schema:
          type: string
    post:
      tags:
        - Reload
      summary: "foo bar"
      operationId: "reload"
      # etc.

Produces the following Kotlin code:

@Validated
@RequestMapping("\${api.base-path:/v1}")
interface ReloadApi {


    @RequestMapping(
            value = ["/reload"],
            produces = ["application/json"], 
            consumes = ["application/json"],
            method = [RequestMethod.POST])
    fun reload( @RequestHeader(value="x-application-name", required=true) xMinusApplicationMinusName: kotlin.String
, @Valid @RequestBody reloadRequest: ReloadRequest
): ResponseEntity<ReloadResponse> {
        return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
    }
}
Generation Details

Language: Kotlin Build tool: Maven GeneratorName: kotlin-spring library: spring-boot

Assignee
Assign to
Time tracking