OpenAPITools / OpenAPITools/openapi-generator

[BUG][aspnetcore] multi-file upload only presents one file

Open
#9,767 0 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
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Following the directions for "Upload via Multipart Requests" here generates a method only taking one file, instead of an array.

openapi-generator version

current master, docker image hash sha256:8d1bc0ad57397450b9a8a004c5f1d7a512a5e370f3e54837122d44d3fbd5da4b

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: bug example
  version: 0.0.1
paths:
  /example:
    post:
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                filename:
                  type: array
                  items:
                    type: string
                    format: binary
      responses:
        '200':
          description: OK
Generation Details / Steps to reproduce
  1. Save the above file as example.yml
  2. Using docker-for-windows and git-bash, from the same folder as example.yml: MSYS_NO_PATHCONV=1 docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli@sha256:8d1bc0ad57397450b9a8a004c5f1d7a512a5e370f3e54837122d44d3fbd5da4b generate --input-spec "/local/example.yml" --output "/local/example" --generator-name aspnetcore
  3. cat example/src/Org.OpenAPITools/Controllers/DefaultApi.cs

expected: an array or collection of IFormFile as an argument in the generated function
actual function signature is ExamplePost(IFormFile filename)

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

Reproduce the issue with example.yml using the provided Docker command, then inspect the generated example/src/Org.OpenAPITools/Controllers/DefaultApi.cs. Compare the generated ExamplePost signature with the multipart array schema; done means the parameter represents a collection of IFormFile values rather than one IFormFile.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.