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

ActionResponse should implement ToXContentObject #3889

Closed
s1monw opened this issue Oct 11, 2013 · 7 comments
Closed

ActionResponse should implement ToXContentObject #3889

s1monw opened this issue Oct 11, 2013 · 7 comments
Assignees
Labels
:Core/Infra/REST API REST infrastructure and utilities >enhancement Team:Core/Infra Meta label for core/infra team team-discuss

Comments

@s1monw
Copy link
Contributor

s1monw commented Oct 11, 2013

He should across the board implement ToXContent and all responses should implement is without surrounding start/endObject. I started doing one of them in this PR: #3871 but as @martijnvg pointed out we should have all of them being consistent about it.

@clintongormley
Copy link

@s1monw @javanna @cbuescher Have we made progress on this? Is there still more work to be done?

@javanna
Copy link
Member

javanna commented Nov 7, 2016

We didn't make any progress, I think it's still a nice to have, not super important though. In theory it should be about moving ToXContent response creation code from RestActions to ActionResponses.

@javanna
Copy link
Member

javanna commented Nov 7, 2016

Also some related bits here

@javanna
Copy link
Member

javanna commented Dec 16, 2016

This is related to the parsing effort we have been making for the High Level REST Client. We can definitely fix it as we go. @tlrx what do you think?

@tlrx
Copy link
Member

tlrx commented Dec 16, 2016

I agree, would be nice to fix that.

@javanna javanna assigned javanna, tlrx and cbuescher and unassigned s1monw Dec 16, 2016
@javanna javanna removed the help wanted adoptme label Dec 16, 2016
@javanna javanna changed the title ActionResponse should implement ToXContent ActionResponse should implement ToXContentObject Jan 7, 2017
@javanna
Copy link
Member

javanna commented Jan 7, 2017

I updated the title of this issue as at this point ActionResponse should implement ToXContentObject and not ToXContent

javanna added a commit to javanna/elasticsearch that referenced this issue May 26, 2017
SearchScrollRequest can be created from a request body, but it doesn't support the opposite, meaning printing out its content to an XContentBuilder. This is useful to the high level REST client and allows for better testing of what we parse.

Moved parsing method from RestSearchScrollAction to SearchScrollRequest so that fromXContent and toXContent sit close to each other. Added unit tests to verify that body parameters override query_string parameters when both present (there is already a yaml test for this but unit test is even better)

Relates to elastic#3889
javanna pushed a commit that referenced this issue Mar 23, 2018
…28878)

While working on #27799, we find that it might make sense to change BroadcastResponse from ToXContentFragment to ToXContentObject, seeing that it's rather a complete XContent object and also the other Responses are normally ToXContentObject.

By doing this, we can also move the XContent build logic of BroadcastResponse's subclasses, from Rest Layer to the concrete classes themselves.

Relates to #3889
javanna pushed a commit that referenced this issue Mar 23, 2018
…28878)

While working on #27799, we find that it might make sense to change BroadcastResponse from ToXContentFragment to ToXContentObject, seeing that it's rather a complete XContent object and also the other Responses are normally ToXContentObject.

By doing this, we can also move the XContent build logic of BroadcastResponse's subclasses, from Rest Layer to the concrete classes themselves.

Relates to #3889
@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 2020
@tlrx tlrx removed their assignment Oct 7, 2020
@rjernst rjernst added the needs:triage Requires assignment of a team area label label Dec 3, 2020
@jaymode jaymode added team-discuss and removed needs:triage Requires assignment of a team area label labels Dec 14, 2020
@rjernst
Copy link
Member

rjernst commented Apr 21, 2021

We discussed this issue in core/infra today. While it is certainly an admirable goal, and may be nice to have, forcing all ActionResponses to have xcontent representations has not been a priority for over 7 years. In practice, the responses that need xcontent get it through other subclasses, and transport actions are often separated from the REST side that needs xcontent, so in many cases it is not necessary. Given that, we don't plan to work on this.

@rjernst rjernst closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/REST API REST infrastructure and utilities >enhancement Team:Core/Infra Meta label for core/infra team team-discuss
Projects
None yet
Development

No branches or pull requests

9 participants