gql-parser 0.1.2
a gql parser that focus on compile time schema generating, and parse just raw dlang class to gql type.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
GQL-Parser
what it is for
- parsing dlang type to gql schema at only compile time(the whole parsing things could be evaluated by pragma)
- just raw dlang types with a little attributes(without any toxxx function or interface implementation)
- schema is just a dlang char[], you can use it with any server support string stream or just send it as a text page
how to use
@object_("ObjectA") class A
{
int a;
this()
{
a = 0;
}
}
@input("InputB") class B
{
string b;
this()
{
b = "";
}
}
@scalar_("CustomScalar____1") struct CustomScalar
{
int c;
}
@enum_("CustomEnum_____1") enum CustomEnum: string
{
A = "A",
B = "B",
C = "C"
}
class Query
{
string hello(string name)
{
return "hello " ~ name;
}
A getA()
{
return new A();
}
}
class Mutation
{
void addB(B[] b)
{
b ~= new B();
}
}
pragma(msg, Schema.parseSchema!(Query, Mutation, void, A, B, CustomEnum, CustomScalar)());
// gonna see something like this:
// type ObjectA {
// a: Int!
// }
// input InputB {
// b: String!
// }
// enum CustomEnum_____1 {
// A
// B
// C
// }
// scalar CustomScalar____1
// type query {
// hello(name: String!): String!
// getA(): ObjectA!
// }
// type mutation {
// addB(b: [InputB!]!): Void!
// }
to-dos
- [x] more compile time things
- [x] using parseSchema(Query, Mutation, Subscription) only, all extra types is auto-added
- [x] support interface checker at compile time
- [ ] gen Also gql documentation page, not just schema
- [ ] used as a vibe.d plugin
- [ ] handler and controller for gql request that could be merged into Query type
- [ ] gql request to dlang function call
- [ ] schema docs though vibe.d
- [ ] perfomance tests
- [ ] gql value to dlang value
- [x] interface support
- [ ] directive support
- 0.1.2 released 32 days ago
- deathcodebind/gql-parser
- AGPL-3.0-or-later
- Copyright © 2025, enigma
- Authors:
- Dependencies:
- vibe-d
- Versions:
-
0.1.2 2025-Jul-30 0.1.1 2025-Jul-30 0.1.1-fix 2025-Jul-30 0.1.0 2025-Jul-30 ~main 2025-Jul-30 - Download Stats:
-
-
0 downloads today
-
1 downloads this week
-
1 downloads this month
-
6 downloads total
-
- Score:
- 0.4
- Short URL:
- gql-parser.dub.pm