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

fix(gengapic): remove encoded quotes in query params #1364

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

noahdietz
Copy link
Collaborator

Removes all quotation marks from protojson encoded well known types that are encoded as strings. Lazily use strings.ReplaceAll to make it easier when the WKT doesn't necessarily have quotations included.

Showcase integration still works (some other languages do not encode quotations), and I tested locally with another API's samples.

Fixes #1363

@noahdietz
Copy link
Collaborator Author

cc: @Charlesleonius

@Charlesleonius
Copy link

What if there are valid quotes within the marshaled data?

@noahdietz
Copy link
Collaborator Author

noahdietz commented Jun 20, 2023

Some quick testing of different WKT encodings: https://go.dev/play/p/kTiZbZRDd37

Number specific wrapper types e.g. DoubleValue will be encoded as the raw number, not a string, whereas BytesValue, for example, will be a quoted string. A ListValue or Value of any of the string-encoded wrapper types will also involve quotes but such a value isn't typically used in the query params...updated the solution to handle just the known string encoded types

@noahdietz
Copy link
Collaborator Author

What if there are valid quotes within the marshaled data?

Yeah I've switched back to that more targeted solution to avoid replacing quotes in StringValue fields.

@codyoss codyoss merged commit 5d62c34 into googleapis:main Jun 20, 2023
7 checks passed
@noahdietz noahdietz deleted the fix-wkt-strings branch June 20, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regapic: well known types encoded as strings have extra quotations
3 participants