Skip to content

Supports return json type of response#6261

Closed
zyfjeff wants to merge 15 commits intoenvoyproxy:masterfrom
zyfjeff:refactor_send_local_reply
Closed

Supports return json type of response#6261
zyfjeff wants to merge 15 commits intoenvoyproxy:masterfrom
zyfjeff:refactor_send_local_reply

Conversation

@zyfjeff
Copy link
Member

@zyfjeff zyfjeff commented Mar 12, 2019

Signed-off-by: tianqian.zyf tianqian.zyf@alibaba-inc.com

Description: Refactor sendLocalReplay and Supports return json type of response
Risk Level: low
Testing: add new unit tests
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue] #6166

@zyfjeff zyfjeff requested a review from snowp as a code owner March 12, 2019 06:27
@zyfjeff zyfjeff force-pushed the refactor_send_local_reply branch 3 times, most recently from 5b13657 to d441f50 Compare March 12, 2019 08:31
@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 12, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: release (failed build)
🔨 rebuilding ci/circleci: asan (failed build)
🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #6261 (comment) was created by @zyfjeff.

see: more, trace.

@zyfjeff zyfjeff force-pushed the refactor_send_local_reply branch from d441f50 to 30c5ae5 Compare March 12, 2019 08:37
@dnoe
Copy link
Contributor

dnoe commented Mar 12, 2019

Let us know whenever you think this is ready for maintainer review by removing the WIP in the title and I will assign reviewers. Thanks!

/wait

@zyfjeff zyfjeff force-pushed the refactor_send_local_reply branch 2 times, most recently from c9f2d89 to d6b6593 Compare March 13, 2019 11:28
@zyfjeff zyfjeff changed the title WIP: Supports return json type of response Supports return json type of response Mar 13, 2019
@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 13, 2019

@dnoe I finished, can review.

@dnoe dnoe assigned dio Mar 13, 2019
@dnoe
Copy link
Contributor

dnoe commented Mar 13, 2019

@dio can you take a first pass on this?

@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 15, 2019

@dio When you have time, help review the code.

Copy link
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Sorry for the delay.

Looks good. A couple of nits.

Copy link
Member

@dio dio Mar 16, 2019

Choose a reason for hiding this comment

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

Superfluous spacing? And do you think core data here is the correct title for it?

Copy link
Member

Choose a reason for hiding this comment

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

Should this be 1 instead of 3?

Copy link
Member

Choose a reason for hiding this comment

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

Can we expand this comment to tell why we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

#4705

This issue mentions the need to remove the dependency of RapidJSON. The json conversion uses the method of protobuf to convert, so I defined a protobuf for converting the local reply body. I am not sure there are other ways to do the same thing.

Copy link
Member

Choose a reason for hiding this comment

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

has_json_content_type?

Copy link
Member

Choose a reason for hiding this comment

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

s/An LocalReplyInfo populated from the/A populated LocalReplyInfo object from a/

@zyfjeff zyfjeff force-pushed the refactor_send_local_reply branch from 8998614 to 12f8e62 Compare March 18, 2019 03:07
@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 18, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: coverage (failed build)
🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #6261 (comment) was created by @zyfjeff.

see: more, trace.

@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 18, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #6261 (comment) was created by @zyfjeff.

see: more, trace.

@zyfjeff
Copy link
Member Author

zyfjeff commented Mar 18, 2019

@dio PTAL

dio
dio previously approved these changes Mar 22, 2019
Copy link
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks!

@mattklein123 mattklein123 self-assigned this Mar 22, 2019
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks for this, cool feature. I'm flushing out some initial comments, so let's iterate on these and then once resolved I will take another pass. Thank you!

/wait

Copy link
Member

Choose a reason for hiding this comment

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

I think maybe call this LocalReply since eventually we might want to include other things in here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree

Copy link
Member

Choose a reason for hiding this comment

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

"Local reply"

Copy link
Member

Choose a reason for hiding this comment

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

"Used to wrap a local response, and then convert to JSON."

Copy link
Member

Choose a reason for hiding this comment

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

What's the circular dependency issue here? There must be some way to share this logic without copying? Please try to have a common function that both places call?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is a dependent circular reference, Http::Utility references grpc::Common(hasGrpcContentType), grpc::Common refers to Http::Utility(getResponseStatus), so a circular reference is generated, so I copied the hasGrpcContentType method directly here. Implementation.

I don't know which file should be placed on the hasGrpcContentType method so that it can be used together by these two places.

Copy link
Member

Choose a reason for hiding this comment

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

We should not copy the code, so please create a new file where we can share the logic.

Copy link
Member

Choose a reason for hiding this comment

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

Instead of looking at the content type of the request, shouldn't we be looking at the Accept header here? Also, do we think this overall feature should be configurable? I could go either way, but it definitely needs a release note and needs to be documented.

Copy link
Member Author

@zyfjeff zyfjeff Mar 25, 2019

Choose a reason for hiding this comment

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

Sorry, I got it wrong, it should be using Accept header here.

I don't think it needs to be configured here. this is a standard HTTP server that should be done, and we need to constantly improve it.

@dio dio reopened this Jul 26, 2019
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 26, 2019
@dio
Copy link
Member

dio commented Jul 26, 2019

@zyfjeff 👌🏽

zyfjeff added 15 commits July 30, 2019 10:01
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
Signed-off-by: tianqian.zyf <tianqian.zyf@alibaba-inc.com>
@zyfjeff zyfjeff force-pushed the refactor_send_local_reply branch from e414ac9 to c5c1598 Compare July 30, 2019 02:08
@zyfjeff zyfjeff requested a review from zuercher as a code owner July 30, 2019 02:08
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #6261 was synchronize by zyfjeff.

see: more, trace.

// `case normalization <https://tools.ietf.org/html/rfc3986#section-6.2.2.1>`
google.protobuf.BoolValue normalize_path = 30;

// Used to configure the Local reply the type of the body
Copy link
Member

Choose a reason for hiding this comment

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

This is not super clear. Can you write a more detailed description of what this field is doing?

],
)

api_proto_library(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I would consider this a core type. Is this a generic JSON description or very specific to the idea of returning a JSON reply from HCM?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, Struct would be the canonical representation of JSON in proto.


// [#protodoc-title: Local reply configuration]

// Configure the local reply of the body type
Copy link
Member

Choose a reason for hiding this comment

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

What is the body type?

@stale
Copy link

stale bot commented Aug 7, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 7, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Aug 15, 2019
@lizan lizan mentioned this pull request Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale stalebot believes this issue/PR has not been touched recently waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants