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

-f, --format <format>

Output format (default=graphql)

Options

graphql

--metadata, --no-metadata

Include metadata in output (default=–metadata)

--useuris, --metauris

Include metadata in output (default=–useuris)

-im, --importmap <importmap>

Import mapping file

--log_level <log_level>

Logging level (default=WARNING)

Options

CRITICAL | ERROR | WARNING | INFO | DEBUG

--mergeimports, --no-mergeimports

Merge imports into source file (default=mergeimports)

Arguments

YAMLFILE

Required argument

Code