The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild


Hive logoHive blurred logo


Schema Registry for your GraphQL Workflows

Envelop Logo


Get Started

Plugin Hub > useLazyLoadedSchema

yarn add @envelop/core


This plugin is the simplest plugin for specifying your GraphQL schema. You can specify a schema created from any tool that emits GraphQLSchema object, and you can choose to load the schema based on the initial context (or the incoming request).

import { envelop, useLazyLoadedSchema } from '@envelop/core'; import { buildSchema } from 'graphql'; async function getSchema({ req }): GraphQLSchema { if (req.isAdmin) { return adminSchema; } return userSchema; } const getEnveloped = envelop({ plugins: [ useLazyLoadedSchema(getSchema), // ... other plugins ... ], });

Plugin Details