Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][Spring] Different in-parameter types generated for api and delegate for binary (application/octet-stream) #9331

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

EmhyrVarEmreis
Copy link
Contributor

@EmhyrVarEmreis EmhyrVarEmreis commented Apr 24, 2021

Related to #8659

Actual api endpoint is using org.springframework.core.io.Resource but delegatee is using org.springframework.web.multipart.MultipartFile
Now both are using the second one, which is recommended by Spring (according to my latest knowledge)
Tests are passing and also generation of the following endpoint works (it does not work on plain 5.1.0)

post:
  operationId: setClientFile
  tags:
    - clients
  parameters:
    - $ref: '#/components/parameters/clientId'
  requestBody:
    required: true
    content:
      application/octet-stream:
        schema:
          type: string
          format: binary
  responses:
    204:
      description: No records found
    415:
      description: Invalid image type
    200:
      description: Upload successful

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @nmuesch

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

…es generated for api and delegate for files
@EmhyrVarEmreis
Copy link
Contributor Author

@agilob
@wing328

@EmhyrVarEmreis EmhyrVarEmreis changed the title [Java][Spring] Fix for #8659 Different in-parameter types generated for api and delegate for files [Java][Spring] Fix for #8659 Different in-parameter types generated for api and delegate for binary (application/octet-stream) Apr 24, 2021
@xross-criss
Copy link

I am waiting for this merge too. Hope you would do it quite fast :). Thanks in advance.

@wing328
Copy link
Member

wing328 commented Apr 26, 2021

Tested locally and the result is good.

@wing328 wing328 merged commit b9a1c8f into OpenAPITools:master Apr 26, 2021
@wing328 wing328 changed the title [Java][Spring] Fix for #8659 Different in-parameter types generated for api and delegate for binary (application/octet-stream) [Java][Spring] Different in-parameter types generated for api and delegate for binary (application/octet-stream) Apr 26, 2021
@apinske
Copy link

apinske commented May 7, 2021

That'a a breaking change in a fix-version. I have to change my code from Resource to MultipartFile and then it doesn't even work anymore because application/octet-stream is not considered by spring's multipart resolver. So the parameter is null at run time.

@beckerjohannes
Copy link
Contributor

That'a a breaking change in a fix-version. I have to change my code from Resource to MultipartFile and then it doesn't even work anymore because application/octet-stream is not considered by spring's multipart resolver. So the parameter is null at run time.

Even more, it breaks the ability to return binary content. See #9462

agilob added a commit to agilob/openapi-generator that referenced this pull request May 22, 2021
…eter types generated for api and delegate for files (OpenAPITools#9331)"

This reverts commit b9a1c8f.
wing328 pushed a commit that referenced this pull request May 23, 2021
…enerated for api and delegate for files (#9331)" (#9555)

This reverts commit b9a1c8f.
premiumitsolution pushed a commit to premiumitsolution/openapi-generator that referenced this pull request May 26, 2021
…eter types generated for api and delegate for files (OpenAPITools#9331)" (OpenAPITools#9555)

This reverts commit b9a1c8f.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants