-
Notifications
You must be signed in to change notification settings - Fork 47
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
Invalid semicolon separator in query
error when enabling numeric enum feature.
#1255
Comments
Invalid semicolon separator in query
error when enabling numeric enum feature.
As per the comment you cite, the semicolon must be escaped (once). To be clear, the It seems like the Java query string builder is doing some encoding (if you pass the |
We don't encode the URI in the generator itself, we are relying on a shared library to do it. It's possible but it would not a trivial change as well, it also has a big impact as all apiary libraries are using it for URI encoding as well. In addition, I don't think changing the Java implementation for showcase tests is the right approach to solve this problem. As you mentioned |
@blakeli0 : Could you clarify which shared library is responsible for the URI encoding? |
google-http-java-client. I didn't get a chance to test it but the encoding logic is probably in UriTemplate, see the unit tests of the class. |
Had to focus on some other work, so I'm only now getting back to this.
Can you post-process the encoding before emitting the request? In that case, you can look for raw semicolons the library did not encode and encode them in the generator.
I agree with this principle, but there are three considerations:
|
Update: I have not had a chance to work on this. It seems to me that there are two fundamental parties at fault here: the Java libraries for not encoding On the Go side, as I said, we should see whether we can intercept the query string in Showcase before it gets processed, but I haven't gotten around to it. On the Java side, is there any way to get the library to escape |
The
semicolon
is no longer a supported separator as described in golang.org/issue/25192In the Java gapic-generator, the query parameter
json;enum-encoding=int
is appended to requests when the numeric enum feature is enabled. See HttpJsonServiceStubClassComposer for reference. This results in the following error message from the showcase server:See also related issue in gapic-generator-java: googleapis/sdk-platform-java#1187
Additionally, replacing
;
with%3b
according to the guidelines results in the parameter being double escaped:The issue appears to be rooting from
url.ParseQuery
. According to the function's Go documentation:A few open-ended questions to possibly help address this:
url.ParseQuery
viaURLEncoder.encode(queryString)
?&
as a separator?Thank you!
cc/ @burkedavison @blakeli0
The text was updated successfully, but these errors were encountered: