GraphQL#

GraphQL is a language for describing the structure of data to be returned in an API.

Note

This generator will only create GraphQL definitions, it will not create runtime bindings.

Example Output#

personinfo.graphql

Overview#

Graphql can be generated from a LinkML schema.

To run:

gen-graphql personinfo.yaml > personinfo.graphql

Inheritance#

type Person implements HasAliases
  {
    id: String!
    name: String
    description: String
    image: String
    primaryEmail: String
    birthDate: String
    ageInYears: Integer
    gender: GenderType
    currentAddress: Address
    hasEmploymentHistory: [EmploymentEvent]
    hasFamilialRelationships: [FamilialRelationship]
    hasMedicalHistory: [MedicalEvent]
    aliases: [String]
  }

Docs#

Command Line#

gen-graphql#

Generate graphql representation of a LinkML model

gen-graphql [OPTIONS] YAMLFILE

Options

-V, --version#

Show the version and exit.

-f, --format <format>#

Output format

Default:

graphql

Options:

graphql

--metadata, --no-metadata#

Include metadata in output

Default:

True

--useuris, --metauris#

Use class and slot URIs over model uris

Default:

True

-im, --importmap <importmap>#

Import mapping file

--log_level <log_level>#

Logging level

Default:

WARNING

Options:

CRITICAL | ERROR | WARNING | INFO | DEBUG

-v, --verbose#

Verbosity. Takes precedence over –log_level.

--mergeimports, --no-mergeimports#

Merge imports into source file (default=mergeimports)

--stacktrace, --no-stacktrace#

Print a stack trace when an error occurs

Default:

False

Arguments

YAMLFILE#

Required argument

Code#