Add ability to pass params through to action even if proto is defined #1
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.
This patch adds the ability to pass params to action calls even when we've defined a proto. This is to simply the case when working with legacy code where data is included in parameters that are outside the scope of the defined protobufs. E.g. imagine this case:
curl http://example.com/ping?timeout=500
In this simple case, we would likely define the following route in HyperBuffs,
That is, since there's no real body to parse, we accept nothing for the request protobuf. To accept the timeout field, we could either define a body:
or, in this case, we could simply now call passthrough:
The choice is whether or not the
Ping
message is truly a defined input schema. The thought is that legacy projects adopting HyperBuffs may allow someparam
input as they shift purely onto protobuf definitions.Note: this can also be accomplished by calling
conn.params["timeout"]
, but it does not seem it's the intention of Phoenix actions to dig into the conn object for parameters.