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

Code generation producing model-specific InputStream rather than java.io.InputStream #1230

Closed
brucej72 opened this issue Sep 29, 2023 · 2 comments

Comments

@brucej72
Copy link

Expected Behavior

When generating classes for https://platform.reapit.cloud/docs/swagger/agencyCloud_swagger.json into package com.reapit.api and com.reapit.model I expect the generated class DocumentsAPI.java to have the method:

@Get("/documents/{id}/download")
    @Consumes({"application/octet-stream"})
    Mono<InputStream> getDocumentContentById()

Actual Behaviour

The generated code has the incorrect package for InputStream. Instaead of being java.io.InputStream it is referencing com.reapit.model.InputStream which does not exist.
This seems to be because the endpoint is defined as:
"responses": { "200": { "description": "Success", "schema": { "format": "binary", "type": "string" } },
which is correct per the OpenAPI spec, but the generator is not using java.io.InputStream for it.

Steps To Reproduce

  1. Following this example here: https://guides.micronaut.io/latest/micronaut-openapi-generator-client-maven-java.html
  2. substituting curl https://platform.reapit.cloud/docs/swagger/agencyCloud_swagger.json -o src/openapi/reapit.json in step 4.1 and
  3. <micronaut.openapi.definition>src/openapi/reapit.json</micronaut.openapi.definition> <micronaut.openapi.api.package.name>com.reapit.api</micronaut.openapi.api.package.name> <micronaut.openapi.model.package.name>com.reapit.model</micronaut.openapi.model.package.name> in 4.2
  4. mvn compile generates an error

Environment Information

MacOS X 13.6
JDK 17.0.7

Example Application

No response

Version

4.1.2

@brucej72
Copy link
Author

brucej72 commented Sep 29, 2023

This could be fixed by #1225 but I'm not sure, indeed it looks like it may be a duplicate of #1223

@altro3
Copy link
Collaborator

altro3 commented Sep 29, 2023

@brucej72 yes, it's already fixed. Wait next release

@altro3 altro3 closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants