[WIP] Consistently resolve binary aliases in requests and responses#99
[WIP] Consistently resolve binary aliases in requests and responses#99pkoenig10 wants to merge 2 commits into
Conversation
| TypeMapper returnTypeMapper, | ||
| TypeMapper methodTypeMapper) { | ||
| boolean returnsBinary = endpointDef.getReturns() | ||
| .map(type -> type.accept(TypeVisitor.IS_BINARY)) |
There was a problem hiding this comment.
can we make sure this still works if the endpoint returns an alias of binary? Might be able to use the DealiasingTypeVisitor
There was a problem hiding this comment.
This is the same behavior as the Jersey service generator:
Correctly resolving aliases when settings the response media type is separate from this PR. But I'm not sure it is the correct thing to do. Aliases are completely separate types that wrap the type they are aliasing. You can't stream an alias of a binary.
There was a problem hiding this comment.
As a general rule of thumb, we try to make sure that aliases are pretty transparent so an alias of X should behave as much as possible like X.
We rely on this assumption in the conjure backcompat checker, where introducing an alias is generally considered to be backwards compatible.
There was a problem hiding this comment.
We currently resolve aliases for binary return types, but not for binary body parameters. It seems to me that we would want be handle both cases identically. Should we also be resolving aliases for binary body parameters?
|
I've updated this PR to include the following fixes:
|
| @Path("catalog/datasets/upload-raw-aliased") | ||
| void uploadAliasedRawData( | ||
| @HeaderParam("Authorization") @NotNull AuthHeader authHeader, | ||
| @NotNull InputStream input); |
There was a problem hiding this comment.
Before this change, this would be generated as NestedAliasedBinary
|
Historically, we have treated binary and alias of binary differently. Long term, we want to aliases be completely transparent but I don't think this PR is the place to make that change |
|
Currently they are treated differently for input types but not for returned types. I made this change in response to @dfox's comment above. I just want clarification on the desired outcome here:
|
This is not entirely true: The check you linked is only used to decide whether or not to add the For aliased types we should either do both or neither of:
|
|
This should be rebased on #127 |
|
Closing for now |
This is the change originally intended by #99
Follow up to #92 to correctly implement the conjure spec:
This is consistent with the behavior of other generated clients:
Producesannotation