Skip to content
master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Jul 14, 2019
Jul 14, 2019
Jul 14, 2019
Jul 14, 2019
Jul 14, 2019

README.md

Graphql codegen

graphql_ast_visitor

Provide abstract layer to visit graphql ast nodes.

dart_gen

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.

Roadmap

Enginnering

  • Unit tests
  • CI
  • Docs and Example website

Features

  • Operations
  • Variables
  • Fragments
  • Union Types
  • Directives
  • Generate Graphql codes from ast

Limitions

  • Every Query and Mutation must have a unique name

About

Generate codes from graphql files

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.