[fix] Add Produces annotation for binary alias return types#131
Merged
Conversation
dansanduleac
reviewed
Jan 7, 2019
|
|
||
| private static final ClassName NOT_NULL = ClassName.get("javax.validation.constraints", "NotNull"); | ||
|
|
||
| private static final ClassName BINARY_METHOD_TYPE = ClassName.get(InputStream.class); |
Contributor
There was a problem hiding this comment.
can we call this BINARY_ARGUMENT_TYPE instead, and likewise rename MethodTypeClassNameVisitor to ArgumentTypeClassNameVisitor?
Currently it seems a bit confusing since there's no such thing as a method type.
iamdanfox
approved these changes
Jan 9, 2019
iamdanfox
left a comment
Contributor
There was a problem hiding this comment.
LGTM, I've pushed a couple more commits to continue the refactor and kill the 'Factory' indirection which seemed a bit redundant now. Hope it looks OK!
iamdanfox
reviewed
Jan 9, 2019
| TypeDefinition def = types.get(type); | ||
| if (def.accept(TypeDefinitionVisitor.IS_ALIAS)) { | ||
| Type aliasType = def.accept(TypeDefinitionVisitor.ALIAS).getAlias(); | ||
| TypeName aliasTypeName = aliasType.accept(this); |
Contributor
There was a problem hiding this comment.
Long term I'd like to completely get rid of this class - it's kinda doing some 'dealiasing' here, but it's pretty convoluted with the binary specialization we have going on above.
dansanduleac
approved these changes
Jan 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR
For jersey service endpoints returning a binary alias type, the return type was resolved correctly (to
StreamingOutputorResponse) but the correct@Producesannotation was not applied.After this PR
The
@Producesannotation is applied to endpoints returning binary alias types.See discussion about resolving binary types in #128.