Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Always use InputStream and StreamingOuput for type "any" #421

Open
Kaiser1989 opened this issue Feb 17, 2020 · 0 comments
Open

Always use InputStream and StreamingOuput for type "any" #421

Kaiser1989 opened this issue Feb 17, 2020 · 0 comments

Comments

@Kaiser1989
Copy link

When using type any, the generator creates an "Object" on java side. This makes no sense, as an object cannot be treated correctly. Is it a byte stream? Is it a string? Most converters will fail even before the function is being called.
It's clearer if the parameter is an InputStream. Even if the object is a valid json, the stream can be read to a string and converted correctly.

The same yields for the response, where a StreamingOutput object should be used, so any byte data can be streamed to the client. If Object is returned, most convertes will fail and nothing will be send to the client.

Currently the InputStream variant is only implemented if used with "application/octet-stream". But in my opinion it should be used whenever type "any" occurs.

I added a pull request with a small fix.

Kaiser1989 added a commit to Kaiser1989/raml-for-jax-rs that referenced this issue Feb 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant