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

feat: create @call operator #881

Closed

Conversation

ologbonowiwi
Copy link
Contributor

@ologbonowiwi ologbonowiwi commented Jan 3, 2024

Issue Reference(s):
Fixes #846
/claim #846

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (07d6b78) 88.39% compared to head (ec7c9f4) 82.80%.
Report is 4 commits behind head on main.

❗ Current head ec7c9f4 differs from pull request most recent head 0c56c4f. Consider uploading reports for the commit 0c56c4f to get more accurate results

Files Patch % Lines
src/blueprint/operators/call.rs 98.09% 5 Missing ⚠️
src/blueprint/operators/expr.rs 69.23% 4 Missing ⚠️
src/config/expr.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #881      +/-   ##
==========================================
- Coverage   88.39%   82.80%   -5.60%     
==========================================
  Files          99      100       +1     
  Lines       10721    11000     +279     
==========================================
- Hits         9477     9108     -369     
- Misses       1244     1892     +648     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ologbonowiwi ologbonowiwi force-pushed the feat/#846/create-call-operator branch from 0d5a205 to b0d82b0 Compare January 3, 2024 20:20
@mogery
Copy link
Contributor

mogery commented Jan 29, 2024

The serialization counterpart of this is missing from into_document.rs

@ologbonowiwi
Copy link
Contributor Author

fixed, thank you @mogery

Comment on lines +36 to +92
struct Http {
pub req_template: http::RequestTemplate,
pub group_by: Option<GroupBy>,
pub dl_id: Option<DataLoaderId>,
}

struct GraphQLEndpoint {
pub req_template: graphql::RequestTemplate,
pub field_name: String,
pub batch: bool,
pub dl_id: Option<DataLoaderId>,
}

struct Grpc {
pub req_template: grpc::RequestTemplate,
pub group_by: Option<GroupBy>,
pub dl_id: Option<DataLoaderId>,
}

impl TryFrom<Expression> for Http {
type Error = String;

fn try_from(expr: Expression) -> Result<Self, Self::Error> {
match expr {
Expression::IO(IO::Http { req_template, group_by, dl_id }) => {
Ok(Http { req_template, group_by, dl_id })
}
_ => Err("not an http expression".to_string()),
}
}
}

impl TryFrom<Expression> for GraphQLEndpoint {
type Error = String;

fn try_from(expr: Expression) -> Result<Self, Self::Error> {
match expr {
Expression::IO(IO::GraphQLEndpoint { req_template, field_name, batch, dl_id }) => {
Ok(GraphQLEndpoint { req_template, field_name, batch, dl_id })
}
_ => Err("not a graphql expression".to_string()),
}
}
}

impl TryFrom<Expression> for Grpc {
type Error = String;

fn try_from(expr: Expression) -> Result<Self, Self::Error> {
match expr {
Expression::IO(IO::Grpc { req_template, group_by, dl_id }) => {
Ok(Grpc { req_template, group_by, dl_id })
}
_ => Err("not a grpc expression".to_string()),
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done to avoid unreachable code. I can delete it and use match letting an unreachable _ => Valid::succeed or _ => panic!, let me know which is better, guys.

@ologbonowiwi
Copy link
Contributor Author

I'll open another one. This had many outdated discussions, which makes harder to follow and review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Bounty claim type: chore Routine tasks like conversions, reorganization, and maintenance work. type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a @call operator
5 participants