https://github.com/luizfonseca/graphql-v
GraphQL for V
https://github.com/luizfonseca/graphql-v
graphql vlang
Last synced: 3 months ago
JSON representation
GraphQL for V
- Host: GitHub
- URL: https://github.com/luizfonseca/graphql-v
- Owner: luizfonseca
- License: mit
- Created: 2023-09-17T17:48:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T01:02:31.000Z (about 1 year ago)
- Last Synced: 2025-03-29T03:11:54.530Z (3 months ago)
- Topics: graphql, vlang
- Language: V
- Homepage:
- Size: 123 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL for the V language
## Current state
Work in progress.
- [x] Language Parser (lexer, parser implementation)
- [x] Fixtures are covered 100% (GH, Simple)
- [ ] Integration tests
- [ ] Schema execute
- [ ] Publish to VPM
- [ ] Documentation## Usage
### Parsing a .graphql definition file
You can parse any string/file using the `.parse` function.
It returns a [DocumentNode](./src/graphql/src.graphql.md#documentnode) with al the definitions that were parsed, in a tree structure.```v
import luizfonseca.graphql
import osfn main() {
// For files
file := os.read_file('path-to-file.graphql')// For string inputs
// input := 'query {
// myQuery(id: 1) {
// name
// age
// }
//}'// max_tokens: number of tokens to parse.
// Increasing this means supporting longer queries/schema definitions
doc := graphql.parse(file, graphql.ParserOptions{ max_tokens: 25_000 })dump(doc.token_count)
dump(doc.definitions)
}
```## Links
- [The V programming language](https://vlang.io/)
- [GraphQL](https://graphql.org/)## Notes
- This package is inspired by the work of the GraphQL.js package and as such is not yet perfected for the V lang.
## Contributing
- Feedbacks/PRs are welcome, but keep in mind this is still a **work in progress**.
## Credits
- [GraphQL](https://graphql.org/)
- [GraphQL.js](https://graphql.org/graphql-js/)
- “GraphQL” is a trademark managed by the [GraphQL Foundation](https://graphql.org/foundation/).