OpenAPITools / OpenAPITools/openapi-generator

[BUG] aspnetcore generation multipart/form-data error

Open
#3,086 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • [x ] Have you provided a full/minimal spec to reproduce the issue?
  • [x ] Have you validated the input using an OpenAPI validator (example)?
  • [x ] What's the version of OpenAPI Generator used?
  • [ x] Have you search for related issues/PRs?
Description

When generating aspnetcore skeletton for json interface containing an element of "multipart/form-data:" with object type, the result controller file contains an unexpected method signature with UNKNOWN_BASE_TYPE as parameter Type and parameter name.

openapi-generator version

openapi-generator .3.3.4
openapi-generator .4.01

OpenAPI declaration file content or url
"post": {
"requestBody": {   
"content": {
    "multipart/form-data:": {
        "schema": {
            "type" : "object",
            "properties": {
                "memo": {
                   "type": "string",
                 },
                 "fileToUpload": {
                     "type": "string",
                     "format": "binary"
                  }
              }
          }
      }
}
}
}

The one which works:


"post": {
"requestBody": {   
content": {
      "multipart/form-data:": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      }
}
}
"


##### Command line used for generation

java -jar openapi-generator-cli.jar generate -i  file1.openapi.json --generator-name  aspnetcore -c file1.aspnetcore.config.json -o tmp/

##### Steps to reproduce

launch the generation, the generated controller file will have "UNKNOWN_BASE_TYPE"
as variable type and name.

##### Related issues/PRs
no

##### Suggest a fix


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the aspnetcore generation entry point and the generated controller file produced by the supplied OpenAPI declaration and command. Reproduce the multipart/form-data object case, compare it with the single binary-string case, and consider the issue done when the controller no longer contains UNKNOWN_BASE_TYPE as the parameter type or name.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, java
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.