angel-dart-archive / graphql Goto Github PK
View Code? Open in Web Editor NEWmoved to angel-dart/angel/packages/graphql
Home Page: https://github.com/angel-dart/angel/tree/master/packages/graphql
License: MIT License
moved to angel-dart/angel/packages/graphql
Home Page: https://github.com/angel-dart/angel/tree/master/packages/graphql
License: MIT License
Just... No...
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.
Subscription support is now available (not yet on Pub, also not yet thoroughly tested at all).
I intend to add some functionality to package:graphql_server
that implements Apollo's WebSocket protocol:
https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
This will be built on top of package:stream_channel
(or even just dart:async
, so that users of any framework/infrastructure can use it.
*This issue was automatically moved to: angel-dart/angel#209.
*This issue was automatically moved to: angel-dart/angel#201.
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!
We're looking into a GraphQL parser for our Flutter GraphQL client. The parser from this package seems like a perfect fit. Great work by the way!
Are there any known issues we should consider?
*This issue was automatically moved to: angel-dart/angel#202.
*This issue was automatically moved to: angel-dart/angel#207.
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.
Can alternatively generate a service :)
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) {
...
}
}
*This issue was automatically moved to: angel-dart/angel#206.
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
*This issue was automatically moved to: angel-dart/angel#198.
See https://github.com/jaydenseric/graphql-multipart-request-spec.
Relatively simple spec, will be very simple to implement in graphQLHttp
.
In fact, I'm about to hack out a quick implementation for a small project, and will put it in this branch: https://github.com/angel-dart/graphql/tree/file-uploads
Should generate function to select from a List of objects based on @GraphQLSchema()
*This issue was automatically moved to: angel-dart/angel#204.
*This issue was automatically moved to: angel-dart/angel#208.
*This issue was automatically moved to: angel-dart/angel#205.
It'd be super nice!
*This issue was automatically moved to: angel-dart/angel#200.
Are subscriptions planned?
*This issue was automatically moved to: angel-dart/angel#203.
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.
Would it be an issue to switch to using Prisma's GraphQL Playground instead of GraphiQL? I think it looks better, at least. If not officially supported, any ideas on how I can switch it in?
*This issue was automatically moved to: angel-dart/angel#199.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.