fix(grpc-transcode): resolve proto_id given as an integer - #13811
Open
alirezashamsabad wants to merge 1 commit into
Open
fix(grpc-transcode): resolve proto_id given as an integer#13811alirezashamsabad wants to merge 1 commit into
alirezashamsabad wants to merge 1 commit into
Conversation
5 tasks
Author
|
Related: #13812 adds a feature to the same plugin. The two are independent and do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
id_schemaallows a resource id to be either a string or an integer, and thegrpc-transcodedocs typeproto_idasstring/integer. Butcreate_proto_objcompares the configured
proto_idagainst the stored id with==, and in Lua1 == "1"is false. The admin API stores the id as a string, so any Routeconfiguring
"proto_id": 1fails to resolve its proto:Reproducer against master: two Routes over the same proto, one with the id as a
string and one as an integer.
/strtranscodes,/intreturns an error and logsfailed to find proto by id: 1.This compares both sides as strings, matching how
graphql-proxy-cacheandupstream.luaalready normalize ids.Which issue(s) this PR fixes:
Fixes #8952, which was closed as
stale without a fix. The report is still reproducible on master.
Tests
Two blocks added to
t/plugin/grpc-transcode.t: a Route configured with aninteger
proto_id, and a request through it. Both fail without the change andpass with it.
Developed with AI assistance; design decisions, review and testing are my own.
Checklist
proto_idasstring/integer; this makes the code match them)