tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

Feature add `compose` command

Open tusharmath opened this issue 2 years ago • 15 comments

We should create a new compose command that allows us to compose configurations. This feature is already implemented via check command.

Usage for compose Print the composed configuration on the terminal using a format

tailcall compose a.yml b.graphql c.json --format=YML

Improvements in check Passing --blueprint should print the blueprint on the CLI.

tailcall check a.yml b.graphql c.json --blueprint

Additional Requirements

  • Drop the --out parameter from check

tusharmath avatar Dec 25 '23 13:12 tusharmath

/bounty 200

tusharmath avatar Dec 25 '23 14:12 tusharmath

💎 $200 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 #782 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 🙏 Thank you for contributing to tailcallhq/tailcall! 🙋‍♂️ Join our discord channel if you need help.

algora-pbc[bot] avatar Dec 25 '23 14:12 algora-pbc[bot]

Hey, may I work on this?

adelinaenache avatar Dec 25 '23 14:12 adelinaenache

in queue if re-assigned

Ashu999 avatar Dec 25 '23 16:12 Ashu999

in queue

melsonic avatar Dec 25 '23 17:12 melsonic

/attempt #782, in queue

Shylock-Hg avatar Dec 26 '23 03:12 Shylock-Hg

@Shylock-Hg: 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.

algora-pbc[bot] avatar Dec 26 '23 03:12 algora-pbc[bot]

@tusharmath Hey there, I have some questions:

  1. In what format should be the configuration displayed in the terminal? (when there is no out file)?
  2. If there is no out file, wouldn't be a good idea to add a parameter that specify the format of the composed config displayed?
  3. What is the difference between the blueprint and the config? I can see that there is a function display_schema that prints only the schema from the blueprint, but I am not sure that is what it should output.

adelinaenache avatar Dec 27 '23 00:12 adelinaenache

@adelinaenache Good questions

In what format should be the configuration displayed in the terminal? (when there is no out file)?

Default should be "pretty" json. But user should be able to customize it via the --format.

If there is no out file, wouldn't be a good idea to add a parameter that specify the format of the composed config displayed?

Yes. We can add a --format option.

What is the difference between the blueprint and the config? I can see that there is a function display_schema that prints only the schema from the blueprint, but I am not sure that is what it should output.

Config is what is inputted by the user. It validated and converted into a blueprint. The blueprint is like config, but stricter. If we have a blueprint we can be sure that a graphql server can be built using it, however we can't guarantee the same using a Config.

tusharmath avatar Dec 27 '23 06:12 tusharmath

Config is what is inputted by the user. It validated and converted into a blueprint. The blueprint is like config, but stricter. If we have a blueprint we can be sure that a graphql server can be built using it, however we can't guarantee the same using a Config.

Ok so I'm trying to figure out what should I output when --blueprint is used vs when it's not used. Until now, I get that I should use the Config class to output normal configuration and the generated Blueprint class when using --blueprint. So, what am I getting until now is:

  1. For normal configuration (without --blueprint option), shouldn't be any validity check in place? (just read from files and do not convert it into a blueprint, output the config just like with check)
  2. With --blueprint option, should I add some additional code on the Blueprint that converts it to either YML or json and use that to write to file?
  3. Why we disallow writing GQL schemas with --blueprint? (@tusharmath)

adelinaenache avatar Dec 27 '23 09:12 adelinaenache

For normal configuration (without --blueprint option), shouldn't be any validity check in place? (just read from files and do not convert it into a blueprint, output the config just like with check)

Yes we should just compose them together without validating.

With --blueprint option, should I add some additional code on the Blueprint that converts it to either YML or json and use that to write to file?

You can use serde and serde_yml to do this.

Why we disallow writing GQL schemas with --blueprint?

I am not sure what you mean by this question.

tusharmath avatar Dec 27 '23 11:12 tusharmath

@adelinaenache Let me know if you are still on this or if I should reassign.

tusharmath avatar Dec 29 '23 07:12 tusharmath

@tusharmath still on this

adelinaenache avatar Dec 29 '23 12:12 adelinaenache

@tusharmath I want to work on this one can you assign this to me?

melsonic avatar Dec 31 '23 07:12 melsonic

💡 @adelinaenache submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Dec 31 '23 10:12 algora-pbc[bot]

🎉🎈 @adelinaenache has been awarded $200! 🎈🎊

algora-pbc[bot] avatar Jan 04 '24 16:01 algora-pbc[bot]