OpenAPITools / OpenAPITools/openapi-generator

Question: how to generate MultipartFile for binary string

Open
#13,019 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Hi, can you, please, help me generate array/collection of org.springframework.web.multipart.MultipartFile for files array:

type: array
items:
  type: string
  format: binary

Currently I only get collection of org.springframework.core.io.Resource. I tried typeMappings/importMappings/mustache templates, but w/o success.

I've created question regarding this problem on stackoverflow: https://stackoverflow.com/questions/73107663/how-to-generate-multipartfile-for-binary-string-by-openapitools.

openapi-generator version

openapi-generator-cli:5.0.1

OpenAPI declaration file content or url
{
  "generatorName": "spring",
  "library": "spring-cloud",
  "hideGenerationTimestamp": true,
  "globalProperties": {
    "skipFormModel": false
  },
  "openApiNullable": false,
  "java8": true,
  "jsr310": true
}
Command line used for generation

gradle file:

swaggerSources {
    assetApi {
        inputFile = file('swagger/api.yaml')
        code {
            language = 'spring'
            configFile = file("swagger/config.json")
            components = ['models': true, 'apis': true]
            templateDir = file('templates/java')
        }
    }
}
Steps to reproduce

N/A

Related issues/PRs

N/A

Suggest a fix/enhancement

If there's solution of this problem, probably it should be added to project's readme.

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 supplied OpenAPI binary-array declaration, the Spring generator configuration, and the custom templates/java directory; compare the generated Resource collection with the requested MultipartFile collection. Determine whether the mapping is supported, then document the confirmed configuration or limitation in the project README.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, backend, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.