1.0.1 • Published 6 years ago

graphql-schema-process v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

graphql-schema-process

CLI for graphql join & preprocessor

Dependences:

  • Yargs, Used for parsing CLI arguments
  • Schemaglue, Used for joining schemas
  • graphql-s2s, Used for supporting Type Inheritance & Generic Types

Usage:

graphql-schema-process <cmd> [options]

Commands:
  graphql-schema-process parse <path>  Preprocess and join schemas
  graphql-schema-process join <path>   Join schemas

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

Preprocessor features:

  • Single Inheritance:

  type Node {
    id: ID!
  }

  # Inheriting from the 'Node' type
  type Person inherits Node {
    firstname: String
    lastname: String
  }

  # Inheriting from the 'Person' type
  type Student inherits Person {
    nickname: String
  }
  • Multiple Inheritance:

  type Node {
    id: ID!
  }

  type Address {
    streetAddress: String
    city: String
    state: String
  }

  # Inheriting from the 'Node' & 'Adress' type
  type Person inherits Node, Address {
    id: ID!
    streetAddress: String
    city: String
    state: String
    firstname: String
    lastname: String
  }
  • Generic Types:

  type Paged<T> {
    data: [T]
    cursor: ID
  }

  type Question {
    name: String!
    text: String!
  }

  # Using the generic type
  type Student {
    name: String
    questions: Paged<Question>
  }

  # Using the generic type
  type Teacher {
    name: String
    students: Paged<Student>
  }
1.0.1

6 years ago

1.0.0

6 years ago