8000 Added @Body by shiraji · Pull Request #1615 · androidannotations/androidannotations · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@shiraji
Copy link
Contributor
@shiraji shiraji commented Nov 1, 2015

see #1602

  • Added @Body annotation
  • Refactered validations for REST annotations
  • Added/Fixed tests

@WonderCsabo
Copy link
Member

I think urlVariableNamesExistInParametersAndHasOnlyOneEntityParameterOrOneOrMoreParameter and friends could be totally refactored. This was one of the reasons for the change.

We should have a validation method which validates all rest methods in the interface has all its parameters annotated with one appropriate annotation. Another method which validates that @Body is only added once. The same name of the form parameters should be also refactored to another method etc.

So one of the reasons of this PR that now all method parameteres are annotated, so it is easier to validate and handle them.

@shiraji
Copy link
Contributor Author
shiraji commented Nov 6, 2015

I will squash commits later.

I have a question about @RequiresCookieInUrl. Is this annotation always required url placeholder? Like this?

@Post("/events/{date}?myCookieInUrl={myCookieInUrl}")
@RequiresCookieInUrl("myCookieInUrl")

I thought it must have url placeholder so I changed test cases.

@WonderCsabo
Copy link
Member

@shiraji yeah it does need a placeholder. Check out this.

@WonderCsabo
Copy link
Member
WonderCsabo commented Nov 6, 2015 via email

@shiraji
Copy link
Contributor Author
shiraji commented Nov 6, 2015

No problem!

I will add more tests for this.

@shiraji shiraji changed the title [WIP] add @Body Added @Body Nov 7, 2015
@shiraji
Copy link
Contributor Author
shiraji commented Nov 7, 2015

Does @Body annotation require FormHttpMessageConverter? If yes, this pull request is ready for reviewing.

@WonderCsabo
Copy link
Member
WonderCsabo commented Nov 7, 2015 via email

@shiraji
Copy link
Contributor Author
shiraji commented Nov 7, 2015

OK, let me fix that.

@shiraji
Copy link
Contributor Author
shiraji commented Nov 7, 2015

Done. Could you review this pull request? Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three validations are present in multiple handlers, what about extracting to a validator method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. how about doesNotHaveRestEntityAnnotatedParameters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean doesNotHaveRequestEntityAnnotatedParameters? It would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. sorry for typo.

@WonderCsabo
Copy link
Member

@shiraji you should review all javadoc for REST method annotations which can have @Body parameter and update the examples and maybe the text as well. The Javadoc on @Rest maybe also have to be updated.

@shiraji
Copy link
Contributor Author
shiraji commented Nov 11, 2015

@WonderCsabo do you prefer to have separate commits for code review? and then after you review the commits, squash these commits?

@WonderCsabo
Copy link
Member

Yeah, it will help reviewing, thanks!

@shiraji
Copy link
Contributor Author
shiraji commented Nov 11, 2015

OK, I am really sorry for careless coding. I should have code very very very carefully. I will fix this as soon as possible.

@WonderCsabo
Copy link
Member

@shiraji no worries!

@shiraji shiraji changed the title Added @Body [WIP] Added @Body Nov 12, 2015
@WonderCsabo
Copy link
Member

@shiraji is this ready to be reviewed?

@shiraji
Copy link
Contributor Author
shiraji commented Nov 14, 2015

@WonderCsabo not yet. I found multiple problems with validations. Hopefully, I will complete this within a few days. If I think these problems are hard to overcome, I may ask your help. Thanks.

@shiraji shiraji changed the title [WIP] Added @Body Added @Body Nov 15, 2015
@shiraji
Copy link
Contributor Author
shiraji commented Nov 15, 2015

@WonderCsabo it's ready for review, now.

WonderCsabo added a commit that referenced this pull request Nov 16, 2015
@WonderCsabo WonderCsabo merged commit 90a00f9 into androidannotations:develop Nov 16, 2015
@WonderCsabo
Copy link
Member

@shiraji great work. Can you update the wiki as well?

@WonderCsabo WonderCsabo added this to the 4.0 milestone Nov 16, 2015
@shiraji
Copy link
Contributor Author
shiraji commented Nov 16, 2015

Thanks, it maybe too late but I thought you want me to squash the commits.

I'll update wiki and let you know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0