Documentation
Features
Laboratory

Laboratory

Under your target page, you'll find the Laboratory page. The Laboratory allows you to explore your GraphQL schema and run queries against a mocked version of your GraphQL service.

Explore your GraphQL schema

You can use the full power of GraphiQL (opens in a new tab) directly within Hive: compose your GraphQL operations, explore with different field and variations, and access your GraphQL schema full documentation.

Lab

Built-in Mocks

You may execute operations directly from the built-in GraphQL, and the results will be fully mocked - powered by GraphQL-Tools mocking capabilities (opens in a new tab).

Using Externally

Hive allow you to consume and use the Laboratory schema with your configured mocks while developing, without running any GraphQL server or gateway.

  1. Up-to-date GraphQL Introspection (opens in a new tab) for using with develpoment tools.
  2. Mocks for executed GraphQL operations.

Laboratory Endpoint

To get started with using the Laboratory schema externally, create a Registry Access Token. You only need to have the read access to the target (or, use the Schema Check Only preset).

Now, click on the Use Schema Externally button on the Laboratory page, and follow the instructions on the form:

Lab Form

To test access to your setup, try running a curl command to run a simple GraphQL query against your mocked schema:

curl -X POST -H "X-Hive-Key: HIVE_TOKEN_HERE" -H "Content-Type: application/json" \
  LAB_ENDPOINT_HERE \
  --data-raw '{"query": "{ __typename }"}'

With GraphQL-Code-Generator

Since the Laboratory schema is a valid GraphQL schema, and supports introspection, you may use it directly with tools like GraphQL-Code-Generator (opens in a new tab). Here's a snippet for using it in a project:

codegen.ts
import { CodegenConfig } from '@graphql-codegen/cli'
 
const labEndpoint = 'LAB_ENDPOINT_HERE'
const labToken = process.env.HIVE_LAB_TOKEN
 
const config: CodegenConfig = {
  schema: [
    {
      [labEndpoint]: {
        headers: {
          'X-Hive-Key': labToken
        }
      }
    }
  ]
}
export default config

Additional resources: