You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For downstream endpoints, there is a bit of a problem with how the request params get passed to the restlib.
sysl generates a req struct which contains the url params and and request body (and presumably the url query params?) but does NOT include any headers.
restlib.DoHTTPRequest() pulls the headers out of the context, and the generated code checks for the required headers. The problem is the service implementation should not care about such details (the fact that downstream is via a REST api should be irrelevant), but the only way to get the header values in is by adding them manually.
The request struct which is generated should contain these header values instead of getting them from the context.
The text was updated successfully, but these errors were encountered:
Lot of the times the headers get passed from upstream to downstream systems which means it is easier to handle them and pass forward inside context.Context. The context.Context is the single source of truth for request headers which is passed forward from upstream to downstream. So I guess its a design tradeoff between purity and convenience.
Different headers need different treatment. Some are pass-through by their very nature (trace id?), others are pass-through in some cases and not others (JWT) and some are actually functional parameters (bad idea, but existing practice).
We should capture the different semantics in Sysl and express them appropriately in codegen.
Some code snippets illustrating the difference between current and desired state would be helpful.
For downstream endpoints, there is a bit of a problem with how the request params get passed to the restlib.
sysl generates a req struct which contains the url params and and request body (and presumably the url query params?) but does NOT include any headers.
restlib.DoHTTPRequest() pulls the headers out of the context, and the generated code checks for the required headers. The problem is the service implementation should not care about such details (the fact that downstream is via a REST api should be irrelevant), but the only way to get the header values in is by adding them manually.
The request struct which is generated should contain these header values instead of getting them from the context.
The text was updated successfully, but these errors were encountered: