tailcall
tailcall copied to clipboard
Validate schema using linters
Tailcall should ensure consistency in building the final GraphQL schema. This is the standard it should follow:
Case styles
- Field names should use
camelCase
. - Type names should use
PascalCase
. - Enum names should use
PascalCase
. - Enum values should use
ALL_CAPS
, because they are similar to constants.
There are two approaches to solve this problem:
- When the setting is enabled, we can throw a validation error that the developer see and fix using the
@modify
operator. - We can automatically fix it for the user.
Proposal
schema @server(lint: {field: true, type: true, enum: true, enumValue: true, autoFix: false}) {
query: Query
}
Technical Requirements
Use the ConfigOptimizer
API defined over here https://github.com/tailcallhq/tailcall/issues/1653
/bounty 300$
💎 $300 bounty • Tailcall Inc.
Steps to solve:
-
Start working: Comment
/attempt #1322
with your implementation plan -
Submit work: Create a pull request including
/claim #1322
in the PR body to claim the bounty - Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts
🙏 Thank you for contributing to tailcallhq/tailcall! 🧐 Checkout our guidelines before you get started. 💵 More about our bounty program.
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟡 @webbdays | Mar 30, 2024, 12:25:13 PM | WIP |
🔴 @varshith257 | Apr 25, 2024, 7:53:27 PM | WIP |
🔴 @Shylock-Hg | May 29, 2024, 10:58:04 AM | WIP |
🔴 @parth-gr | Jul 9, 2024, 7:17:07 PM | WIP |
🔴 @zeul22 | Jul 29, 2024, 3:40:09 PM | WIP |
🔴 @Sadaf-A | Aug 10, 2024, 4:51:14 AM | WIP |
🟢 @beelchester | #2827 |
I'll like to give it a try
Please let me know the place where we parse the file and get final representation of the file for all .graphql, .yml,.json files. When the start command is executed. Thank you.
@webbdays check the blueprint module. All the validations are done there. Create a new file called lint.rs which performs these validations.
Oh OK. I didn't properly understand the project structure.
I have directly used config struct. I think blueprint get info from config struct right.
Created a linter. Working fine. Pushing code changes now. Please look at it once to find any issues. Thank you.
@ssddOnTop Are you still working on this?
@ssddOnTop Are you still working on this?
Yessir
ok
I am dropping this off as of now
@ssddOnTop What is your progress on this until now and what are pending things to work?
@ssddOnTop What is your progress on this until now and what are pending things to work?
Almost everything is pending.. I didn't get much time to focus on this issue. You can check #1329
@webbdays: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏
[!NOTE] The user @webbdays is already attempting to complete issue #1322 and claim the bounty. We recommend checking in on @webbdays's progress, and potentially collaborating, before starting a new solution.
@tusharmath If I am right, we need strict linting. Approach 1 seems good to me. What are your thoughts on this?
@varshith257 the first part is almost done. I am having problem with auto fixing the lint issues. So, i am looking at different approaches to it. You are welcomed to build on the work i have done in the PR #1671 #1795.
Here is the code for different way i am trying; in the pr #1795
There are many cases we have to handle when auto fixing. Because, some of the things like type or the field or the enum can be used in other parts of graphql schema. which we need to correct based of lint requirements. Which we cannot predict some times.
There is this tool for graphql lint checker: https://github.com/cjoudrey/graphql-schema-linter User can use this while developing graphql schema. or we can compile it to web assembly and run with wasm runtime. Also giving the user the cli option to lint. But i think this is overhead to tailcall cli.
Are you going with approach 2? I will give a try with approach 1. Approach 1 seems good for LTS
Hi, @varshith257, seems confused with approach word. I have already done it. (except that i have warned.) we can throw validation error. Only problem is with autofixing. #1795 is different way of doing it so that it might be easy for autofixing the schema.
@varshith257: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏
@algora-pbc Someone is working there. Wouldn't it get conflict?
@varshith257 You can make a pr. I am out of ideas.
/attempt To resolve the problem of referencing identifiers, I plan to introduce an intermediate representation of identifier (maybe a unique number). So, we change the name of identifier and don't modify the original unique number. @tusharmath How do you think about it?
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@Shylock-Hg | 7 tailcallhq bounties + 3 bounties from 3 projects |
C++, C, Shell & more |
Cancel attempt |
[!NOTE] The user @webbdays is already attempting to complete issue #1322 and claim the bounty. We recommend checking in on @webbdays's progress, and potentially collaborating, before starting a new solution.
Sounds good. You need a stable identifier.
@Shylock-Hg: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏