0.5.8 • Published 4 years ago

graphql-api-schema v0.5.8

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

graphql-api-schema

Generates a simple ApiSchema from GraphQLSchema to give simple way to navigate into with typescript.

Can generate and update a JSON file each time apiSchema is modified by a new graphQLSchema with apiSchema.setGraphQLSchema(graphQLSchema).

The JSON file hydrate apiSchema at initialisation time when graphQLSchema is not given.

Examples

With the static form :

import { apiSchema } from 'graphql-api-schema'

// List of directives
apiSchema.directives.keys[] // => [ 'include', 'skip', 'deprecated' ]

// Args of directive 'skip'
apiSchema.directives['skip'].args.keys() // => [ 'if' ]

apiSchema.directives.get('skip').args.get('if') gives :

 {
  name: 'if',
  description: 'Skipped when true.',
  type: {
    isList: false,
    isNullable: false,
    of: {
      kind: 'SCALAR',
      name: 'Boolean',
      description: 'The `Boolean` scalar type represents `true` or `false`.'
    }
  },
  defaultValue: null
}

Initialisation

For the static version :

import { GraphQLApiSchema } from 'graphql-api-schema'
GraphQLApiSchema.init({
  // From root of project
  dirName: 'src'
  // File not modified if not different
  fileName: 'apiSchema.json'
  // Same parameter as for JSON.stringify
  jsonSpaces: 2
})

For the object version, apiSchema can't be accessed staticaly but work's the same way :

import { GraphQLApiSchema } from 'graphql-api-schema'
const graphQLApiSchema = new GraphQLApiSchema({
  dirName: 'src'
  fileName: 'apiSchema.json'
})

const apiSchema = graphQLApiSchema.apiSchema

File generation is optional.

0.5.8

4 years ago

0.5.7

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.3.0

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.0.4-alpha.2

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.1.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.2.2

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago