JSON Schema (@omnigraph/json-schema)
This package generates GraphQL Schema from JSON Schema and sample JSON request and responses. You
can define your root field endpoints like below in your GraphQL Config for example;
schema:
myOmnigraph:
loader: '@omnigraph/json-schema'
endpoint: http://www.my-api.com
schemaHeaders:
Content-Type: application/json
operationHeaders:
Accept: application/json
Content-Type: application/json
Authorization: Bearer TOKEN
operations:
- type: Query
field: me
description: My Profile
path: /user/{args.id}
method: GET
responseSchema: ./json-schemas/user.json#/definitions/User
- type: Mutation
field: createUser
path: /user
method: PUT
requestSample: ./json-samples/user-input.json
requestTypeName: CreateUpdateUser
responseSchema: ./json-schemas/user.json#/definitions/User