Skip to content
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

Generic Response mapping using Expr #349

Merged
merged 117 commits into from
Apr 3, 2024
Merged

Generic Response mapping using Expr #349

merged 117 commits into from
Apr 3, 2024

Conversation

afsalthaj
Copy link
Contributor

@afsalthaj afsalthaj commented Apr 2, 2024

Fixes #316

  • Flexible mapping representation using Expr
  • Although the mapping corresponding to a protocol is parsed during evaluation, a validation is done when we submit the API definition using open API spec as well.
  • There isn't a performance implication for trying to parse it during evaluation, because Expr is already parsed, and all that's done pattern matching on whether it is Expr::Record, and fetch the status, body and header out of it which is a constant big O.

@afsalthaj afsalthaj marked this pull request as ready for review April 2, 2024 17:58
let headers =
ResolvedResponseHeaders::from(&response_mapping.headers, &type_annotated_value)?;
let status_code =
get_status_code(&http_response_mapping.status, &type_annotated_value)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this is a method available on WorkerReponse as to_http_response called only for the Http Request endpoint

@afsalthaj
Copy link
Contributor Author

Not waiting for the worker-executor tests, as the change don't impact this at all.

@afsalthaj afsalthaj merged commit dd82ec1 into main Apr 3, 2024
@afsalthaj afsalthaj deleted the gol_316 branch April 3, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace ResponseMapping with Expr that expects a record consisting between status, headers and body#1343
2 participants