Git Product home page Git Product logo

graphql's People

Contributors

deep-gaurav avatar klavs avatar micimize avatar thosakwe avatar yarcowang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql's Issues

question regarding graphQL gateway

From what i can see Dart / Angel might be an excellent candidate for microservices architecture.

My Use case:
Have many Microservices that are graphql ( written in many languages ) but each has a graphql schema, and so MAYBE with Dart we can make a reflection based gateway that when it gets a GraphQL query / mutation, can manage calling the microservices to fulfil the query / mutation,
The idea is for the Gateway to be very DUMB and require just a few strings.

Dart VM has nice reflection / mirrors and might be able to do this.

Getting introsection-query result at compile time

Is it possible to do this?

We are experimenting with some code generation capabilities. Currently we are able to generate types from an introspection query like so:

@GQLGenerator(
    url: SCHEMA_ENDPOINT,
    headerToken: "...",
    namespace: "T")
class TQuery {
  static TRootQueryType fromJson(Map<String, dynamic> json) =>
      TRootQueryType.fromJson(json);
}

It will generate the root query type, all types, fields, enums, docs (from comments), deprecations and so on. (We've got the code out in the public but I wouldn't say it's production ready yet.)

But currently a url to a GraphQL endpoint has to be specified and our code gen will fetch the introspection result from the graphql endpoint.

We are using angel-dart internally, so we'd also like to support the use case of generating the types from an angel-dart graphql server within the same codebase without the extra step of running it as a server.

Would love some guidance on how to accomplish this. Thanks!

Circular dependencies

I am trying to to create a file containing all my types. My model contains multiple circular dependencies and I am not sure how can I solve this problem. The code below exemplifies the problem:

var type1 = objectType(
  'Type1',
  fields: [
    field('field11', listOf(type2)),
    field('field12', graphQLString),
  ]
);

var type2 = objectType(
  'Type2',
  fields: [
    field('field21', type1),
    field('field22', graphQLString),
  ]
);

The error I get is:
Local variable 'type2' can't be referenced before it is declared.

Thank you for your help.

struct variables are not recognized

You can't pass struct as variables, example:

query something {
  event(someProp: {
    myInnerProp: 123
  }) {
  ...
  }
}

but raw variables are ok with the parser:

query something {
  event(someProp: 123) {
  ...
  }
}

graphql_parser ast stringification

I'd like to use graphql_parser for traversing, modifying, then restringifying a document.
Do you all plan on adding stringification? I'm thinking it would parallel the span logic pretty closely

graphql_builder

Should generate function to select from a List of objects based on @GraphQLSchema()

parser failing on valid query with parameters?

Some test code:

final List<Token> tokens = scan(meQuery);
 final Parser parser = Parser(tokens);

 if (parser.errors.isNotEmpty) {
   // Handle errors...
   print(parser.errors.toString());
 }

 // Parse the GraphQL document using recursive descent
 final DocumentContext doc = parser.parseDocument();

 expect(doc.definitions, isNotNull);
 expect(doc.definitions, isNotEmpty);

Fails with this query:

query customerMemberAttributes($memberId: Int!){
  customerByCustomerId(customerId: 7) {
    customerMemberAttributesByCustomerId {
      nodes {
        customerMemberAttributeId
        memberAttributesByCustomerMemberAttributeId(condition: {memberId: $memberId}) {
          nodes {
            memberAttributeId
          }
        }
      }
    }
  }
}

but not this query:

query customerMemberAttributes($memberId: Int!){
  customerByCustomerId(customerId: 7) {
    customerMemberAttributesByCustomerId {
      nodes {
        customerMemberAttributeId
        memberAttributesByCustomerMemberAttributeId(condition: {memberId: 7}) {
          nodes {
            memberAttributeId
          }
        }
      }
    }
  }
}

I believe these queries are valid and both should work.

graphql_parser lexer incorrectly tokenizes variables named "query", "fragment" or other non-reserved words

I'm trying to parse an operation for use with the GitHub GraphQL API.

query searchRepos($queryString: String!, $repositoryOrder: RepositoryOrder, $first: Int!) {
  search(type: REPOSITORY, query: $queryString, first: $first) {
    ...SearchResultItemConnection
  }
}

I am parsing this document using the following function:

  DocumentContext parseDocument(String doc) {
    var tokens = scan(doc);
    var parser = new Parser(tokens);

    if (parser.errors.isNotEmpty) {
      throw "invalid document";
    }

    return parser.parseDocument();
  }

However, this returns 0 definitions. I found the issue while debugging. The lexer interprets any token named query as a TokenType.QUERY regardless of position.

Screen Shot 2019-03-30 at 8 10 37 AM

This classification breaks the parsing logic when it encounters my variables named "query". I believe this is an error because these words are not reserved in the GraphQL language. Unfortunately I don't believe this is something that can be worked around in this case as the GitHub API declares this variable name and is out of my control.

The document parser should be able to recognize a token named "query", "fragment", "mutation", "subscription", "on", and "null" as a TokenType.NAME when placed in a valid variable or alias location.

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.