Git Product home page Git Product logo

goaphql's Introduction

GoaphQL

Read in | δΈ­ζ–‡ | English

Command Line

# Installation
go get -u -v github.com/wenerme/goaphql/cmd/goaphql

graphql-java

# Generate
# Package com.github
# Name Github
goaphql generate graphql-java -s github.graphqls -P com.github -N GitHub
# same
goaphql g gj -s github.graphqls -P com.github -N GitHub

# Customization
# Dump templates
goaphql dump -t tmpl/graphql-java --prefix tmpl/graphql-java -d ./tpl
# Modify templats
# Add package-info.java
echo -e 'package {{Config.JavaPackage}};' > './tpl/Java#package-info.java.tmpl'
# Generate using modified templates
goaphql generate graphql-java -t ./tpl -s github.graphqls -P com.github -N GitHub
# Check the new file
cat out/me/wener/package-info.java

Dependencies

Generated depends on wenerme/jraphql .

<dependencies>
  <dependency>
      <groupId>me.wener.jraphql</groupId>
      <artifactId>jraphql-graphql-java-adapter</artifactId>
      <version>0.0.2</version>
  </dependency>
  <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.20</version>
      <scope>provided</scope>
  </dependency>
</dependencies>

Inside

Package Description
gqlp GraphQL Parser
gqll GraphQL Language representation
gqlg GraphQL Code generator
cmd/goaphql Command line tool

GraphQL Language Extension

# 1. extend by name syntax

type MyQuery {
  myUser(id:ID!):MyUser
}

extend Query by MyQuery

# 2. Allowed directives on directive definition, add DIRECTIVE_DEFINITION location

directive @JavaType(type:String) on DIRECTIVE_DEFINITION
directive @Auth(value:String) @JavaType(type:"Auth") on FIELD_DEFINITION;

# 3. Allowed schema has optional name
schema Test {
  query: MyQuery
}

Roadmap

  • Parse comment
  • Extract java runtime to jraphql
  • Implement golang runtime
  • Implement golang codegen
  • Implement graphql codegen

goaphql's People

Contributors

wenerme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.