Provide abstract layer to visit graphql ast nodes.
Generate dart codes from graphql ast nodes.
query projectDetail($fullPath: ID!, $first: Int!, $after: String!, $status: PipelineStatusEnum) {
project(fullPath: $fullPath) {
archived
pipelines(first: $first, after: $after, status: $status) {
edges {
cursor
node {
id
iid
sha
status
detailedStatus {
detailsPath
hasDetails
}
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
}
}
}
}...
class ProjectDetailVariable {
ProjectDetailVariable({this.fullPath, this.first, this.after, this.status});
String fullPath;
int first;
String after;
PipelineStatusEnum status;
Map<String, dynamic> toJson() {
return {
'fullPath': fullPath,
'first': first,
'after': after,
'status': PipelineStatusEnumValues.reverseMap[status]
};
}
}
class ProjectDetailQuery {
ProjectDetailQuery({this.project});
factory ProjectDetailQuery.fromJson(Map<String, dynamic> json) {
if (json == null) {
return ProjectDetailQuery();
}
return ProjectDetailQuery(
project: ProjectDetailQueryProject.fromJson(json['project']));
}
ProjectDetailQueryProject project;
Map<String, dynamic> toJson() => {'project': project?.toJson()};
}
...Run dart_gen/example/main.dart to see full output from this graphql
You can also write some more gql files from gitlab to see more generated results.
- Unit tests
- CI
- Docs and Example website
- Operations
- Variables
- Fragments
- Union Types
- Directives
- Generate Graphql codes from ast
- Every
QueryandMutationmust have a unique name