tailcall
tailcall copied to clipboard
Add a `@link` operator
Overview
Introducing the @link operator for linking and importing of external files in configurations.
Proposed GraphQL Schema Definition
schema
@link(type: GraphQL, src: "https://abc.com/graphql")
@link(type: Config, src: "https://abc.com/application.yml")
@link(type: Config, src: "https://abc.com/application.graphql") {
query: Query
}
Proposed Update in .tailcallrc.graphql
directive @link(type: LinkType!, src: URL!) repeatable on SCHEMA
Proposed Rust Type Definitions
#[derive(Debug, Clone)]
enum LinkType {
Config,
GraphQL,
Protobuf, //
Data, // Just pure data that can be used in @const
// Extendable for more types
}
#[derive(Debug)]
struct Link {
type_of: LinkType, // Type of the link
src: String, // Source URL for linked files
id: Option<String>, // Id is used to refer at different places in the config
content: Option<String>, // Stores raw content
}
- Enhanced Debugging and Cloning: Utilizing
#[derive(Debug, Clone)]for ease of debugging and cloning capabilities.
ConfigResolver Module
-
Parallel Processing with Error Handling: Employs Rust's async features for parallel HTTP calls. Implements a fail-fast strategy for error handling, leveraging the existing logging framework.
-
Detailed Logging: Each HTTP operation will be logged, including URL access and operation status, using the existing features of the http-client. This is already implemented inside the http-client.
-
Resolve over HTTP & File: Each link can be resolved using both HTTP and Disk IO, so long as we have access to read the file.
-
Fail-Fast Strategy: Immediate error return upon the first failure encountered, preventing unnecessary processing.
-
Focused Module: The
ConfigResolveris dedicated to fetching and aggregating content. Content parsing is handled in the config-to-blueprint step, ensuring modularity. -
Documentation and Code Comments: Comprehensive documentation and comments within the code and
.tailcallrc.graphqlfor clear understanding of module behaviour. -
Security: Current implementation should only read files that are publicly accesseble.
Practical Application of @link
- Initial Implementation: The
@linkoperator will first be used to execute amerge_rightoperation for any{type: Config}files linked. Themerge_rightmethod already exists onConfig.
/bounty 150$
💎 $150 bounty created by tailcallhq
🙋 If you'd like to work on this issue, comment below to get assigned
👉 To claim this bounty, submit a pull request that includes the text /claim #760 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country. 💵 Payment arrives in your account 2-5 days after the bounty is rewarded. 💯 You keep 100% of the bounty award. 👍 If you go above and beyond by cleaning up or enhancing aspects beyond the scope of the PR, a tip may be awarded as a token of appreciation. 🙏 Thank you for contributing to tailcallhq/tailcall!. 🙋♂️ Join our discord channel if you need help.
@Ameer-officials: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.
/claim #760
Would love to work on this.
@Ashu999: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.
next in line, if need to reassign
@b4s36t4 Should we reassign this?
Releasing this issue for everyone to attempt. @Ashu999 let me know if you'd want me to assign it to you.
@tusharmath yes please, assign it to me
Happy to do this if a need comes up.
I'd like to work on this, can I be assigned?
💡 @ologbonowiwi submitted a pull request that claims the bounty. You can visit your bounty board to reward.
@ologbonowiwi: Your claim has been rewarded! We'll notify you once it is processed.