Giter VIP home page Giter VIP logo

graphql-codegen's People

Contributors

nagorniyaleksandr avatar tinnou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

graphql-codegen's Issues

Several interfaces implementing bug

Hi! Thanks a lot for your work. It's great code generator!

In my case some class is implementing several interfaces. Their schema is like:

{
  "kind": "OBJECT",
  "name": "myClass",
  "description": "No description for myClass",
  "fields": [],
  "inputFields": null,
  "interfaces": [
    {
      "kind": "INTERFACE",
      "name": "firstInterface",
      "ofType": null
    },
    {
      "kind": "INTERFACE",
      "name": "secondInterface",
      "ofType": null
    }
  ],
  "enumValues": null,
  "possibleTypes": null
}

, so generated code should looks like:

public class MyClass implements FirstInterface, SecondInterface {
   ....
}

public interface FirstInterface {
   ....
}

public interface SecondInterface {
   ....
}

but the result of generating of the code is:

public class Appy_Deployment implements firstInterface,  implements secondInterface {
   ....
}

public interface FirstInterface {
   ....
}

public interface SecondInterface {
   ....
}

and we have:

  1. duplicated "implements"
  2. chain of interface names witch starts from lower letter (when interface class name starts from Upper letter).
    As a result we have compilation error.

I've already fixed this issue in my local copy, so I can push code with fixes to some branch if you grant me the appropriate permissions.

Enum types generation issue

Hi!
There are some small issue with generating Enum types.

  1. Class name should starts from the Upper letter.
  2. We have to set some value to each line, because we haven't default constructor.
  3. We should have get method for value

Now our generated code is looks like:

public enum jump {

    START, 
    END

    private String value;

    jump (String value) {
    this.value = value;
    }

    @Override
    public String toString() {
        return value;
    }
}

but. the good code would be that:

public enum **J**ump {

    START**("start")**, 
    END**("end");**

    private String value;

    jump (String value) {
    this.value = value;
    }

    **public String getValue() {
        return value;
    }**

    @Override
    public String toString() {
        return value;
    }
}

for example(or for testing), here is part of schema:

{
  "kind": "ENUM",
  "name": "game",
  "description": "Valid field values for game",
  "fields": null,
  "inputFields": null,
  "interfaces": null,
  "enumValues": [
    {
      "name": "start",
      "description": null,
      "isDeprecated": false,
      "deprecationReason": null
    },
    {
      "name": "end",
      "description": null,
      "isDeprecated": false,
      "deprecationReason": null
    }
  ],
  "possibleTypes": null
}

I've already fixed this issue, so I can push code with fixes to some branch if you provide me permissions.

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.