Open afifurrohman-id opened 2 weeks ago
Hi. Thanks for the example. Does it work if you don't use optional
?
Hi. Thanks for the example. Does it work if you don't use
optional
?
Yes, it works as expected
Ah, very cool! We haven't yet put time into supporting the optional keyword, so this sounds like a bug. The code you want to look at is in https://github.com/grpc-ecosystem/grpc-gateway/blob/ffc412077010576dc94b993f0fd3f27b0d125910/runtime/query.go#L48-L65. I would start by adding a failing test case to https://github.com/grpc-ecosystem/grpc-gateway/blob/main/runtime/query_test.go. Contributions accepted!
🐛 Bug Report
When using
optional
field as request message and will be expected to bind with HTTPurl query parameter
the optional field alwaysnil
To Reproduce
buf.gen.yaml
inputs:
buf.yaml
Generate stub
Create normal grpc gateway server
Test using curl with
url?soft_delete=true
orurl?soft_delete=false
Expected behavior
it should either
false
ortrue
Actual Behavior
Soft delete it will always
nil
Your Environment
Linux GRPC-GATEWAY 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 GNU/Linux