All Projects → granateio → granate

granateio / granate

Licence: MIT license
Code generator for graphql

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to granate

pony-capnp
Cap’n Proto plugin for generating serializable Pony classes. 🐴 - 🎩'n 🅿️
Stars: ✭ 19 (-9.52%)
Mutual labels:  schema, code-generation
DataAnalyzer.app
✨🚀 DataAnalyzer.app - Convert JSON/CSV to Typed Data Interfaces - Automatically!
Stars: ✭ 23 (+9.52%)
Mutual labels:  schema, code-generation
tiles
Programmatic code generation
Stars: ✭ 78 (+271.43%)
Mutual labels:  code-generation
formily
Simple, lightweight, and flexible schema-based form for Vue.js
Stars: ✭ 23 (+9.52%)
Mutual labels:  schema
fling
A fluent API generator
Stars: ✭ 20 (-4.76%)
Mutual labels:  code-generation
vue-example
Vue.js example application (server-side rendering, router, vuex store, form validation, i18n & l10n)
Stars: ✭ 62 (+195.24%)
Mutual labels:  schema
JetBrains-scheme
JetBrains主题,更完美的高亮。支持 IntelliJ IDEA、phpstorm、goland、webstorm
Stars: ✭ 25 (+19.05%)
Mutual labels:  schema
islpy
Python wrapper for isl, an integer set library
Stars: ✭ 58 (+176.19%)
Mutual labels:  code-generation
cscg
Code Generation as a Dual Task of Code Summarization.
Stars: ✭ 28 (+33.33%)
Mutual labels:  code-generation
FSharpWrap
Utility that automatically generates F# modules and functions based on your F# project file's references
Stars: ✭ 14 (-33.33%)
Mutual labels:  code-generation
pocket-cms
☁️ A pocket sized CMS written for nodejs
Stars: ✭ 13 (-38.1%)
Mutual labels:  schema
toast
Plugin-driven CLI utility for code generation using Go source as IDL
Stars: ✭ 52 (+147.62%)
Mutual labels:  code-generation
nmodl
Code Generation Framework For NEURON MODeling Language
Stars: ✭ 42 (+100%)
Mutual labels:  code-generation
really-rich-results
RRR makes structured data for WordPress really rich, and really easy.
Stars: ✭ 21 (+0%)
Mutual labels:  schema
decoratex
No description or website provided.
Stars: ✭ 34 (+61.9%)
Mutual labels:  schema
faker-schema
Generate fake data using joke2k's faker and your own schema
Stars: ✭ 91 (+333.33%)
Mutual labels:  schema
mapper
Map tarantool tuples to php objects.
Stars: ✭ 68 (+223.81%)
Mutual labels:  schema
AUXify
Introduces macro/meta annotations @ aux, @ self, @ instance, @ apply, @ delegated, @ syntax and String-based type class LabelledGeneric
Stars: ✭ 25 (+19.05%)
Mutual labels:  code-generation
typed-astunparse
Python 3 AST unparser with type comments support.
Stars: ✭ 27 (+28.57%)
Mutual labels:  code-generation
sample-generator
Xcode Source Editor Extension to generate Swift model samples
Stars: ✭ 19 (-9.52%)
Mutual labels:  code-generation

!WORK IN PROGRESS!

Granate - Code generator for graphql

Granate is a tool meant to speed up development of applications that utilises graphql. Granate takes a graphql schema and outputs code based on the specified language.

Supported languages

  • Go

Quick start

Install

go get github.com/granateio/granate

Usage

Granate requires a config yaml file granate.yaml to provide some basic information about the project.

# Select language to output
language: go

# Output locations (and some options)
output:
  # Output target directory (value can be empty,
  # but the option is currently required)
  target: <target-dir>

  # Name of the package
  package: change.me/your/package-name/<target-dir>

  # Name of the package to generate for the schema
  schema: schema

  # Name of the package to generate for the models
  models: models

# Schemas to use for the code generator
schemas:
  - schema.graphql

A schema is also required, you can provide multiple schemas in the schemas section of the config file. Here is a simple todo.graphql file

# A user in the system
type User {
    id: ID
    name: String
    todos: [Todo]
}

# A todo
type Todo {
    id: ID
    title: String
    description: String
}

# Root query
type Query {
    # Get the current loged in user
    viewer: User
}

By simply running granate in the same folder as the granate.yaml or placing //go:generate granate at the top of your main.go file and running go generate, three files will be created.

schema/
- definitions.go
- adapters.go
- provider.go

The definitions.go file is where all the graphql specific code is. adapters.go provides a set of interfaces to use for implementing the logic. provider.go contains a set of function to bootstrap the graphql schema as well as providing a graphiql interface to test your schema with.

For a more in depth overview of how to use Granate, check out the simple example under the example folder.

Unsupported features

We support most graphql features. These are examples of things you can't yet generate with granate.

# Define interfaces (the only interface you can use for now is Node, which exists)
interface Entity {
    id: ID!
    name: String
}

# Define scalars
scalar URL

# Define unions
union Animal = Dog | Snake

# Define schemas
# You shouldn't need to do this
schema {
    query: Query
    mutation: Mutation
    subscription: ...
}

See the GraphQL cheat sheet for reference.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].