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
  • #10598
Closed
Open
Issue created Oct 14, 2021 by Administrator@rootContributor

[BUG][JAVA/TYPESCRIPT] Invalid consumes headers generated

Created by: whydoievenneedthis

Description

When image/* is specified for requestBody content type, the generated spring server and typescript client (probably others as well) end up invalid.

On spring side:

    @RequestMapping(
        method = RequestMethod.POST,
        value = "/v1",
        consumes = { "image/_*" }
    )

On typescript side:

        // to determine the Content-Type header
        const consumes: string[] = [
            'image/_*'
        ];
openapi-generator version

5.2.1

OpenAPI declaration file content or url
{
  "paths": {
    "/v1": {
      "post": {
        "summary": "uploadImage",
        "operationId": "uploadImage",
        "requestBody": {
          "content": {
            "image/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}
Generation Details

Generator names were "spring" and "typescript-angular".

Suggest a fix

Tweak DefaultCodegen.addConsumesInfo. Issue is with this line:

mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));

The method escapeText is explicitly breaking /* and */.

Assignee
Assign to
Time tracking