GSDL is a GraphQL SDL preprocessor that adds generic type declaration capabilities to the original GraphQL SDL language. The goal of this project is to reduce code repetition using generic types and type templates (like C++). The idea behind this project comes from this issue that was posted on graphql-spec repo #190
type Query {
me: User
}
type User {
feed(first: Int!, after: String): Connection<Post>!
}
generic type Connection <EdgeType> {
pageInfo: PageInfo
edges: [Edge<EdgeType>!]!
}
generic type Edge <NodeType> {
cursor: String!
node: NodeType!
}
type PageInfo {
startCursor: String!
endCursor: String!
hasNextPage: Boolean!
hasPrevPage: Boolean!
}
This can reduce a lot code repetition in case of implementing a Relay-compilant GraphQL APIs. You can use this library in combination with a schema-first GraphQL server library to implement your APIs more quickly and efficiently.
Currently, the project is not production ready and It might have a lot of edge-cases and bugs that are still unknown. I don't recomand using this project in a real project yet but if you like, you can contribute to this project in order to make it better (or probably production ready)
You can see the current status of the project HERE
This project is based on python SLY package and the file structure of this project is as follows:
lexer.py
: Contains the lexer and the tokensparser.py
: Contains the parser and the grammer rulespreprocessor.py
: Contains the preprocessor and the node visitors that make changes to theGSDL
parse tree to turn it into aGraphQL
parse tree.transpiler.py
: Contains the GraphQL transipler that will output the modified parse tree to a file or ...