apollographql / apollographql/vscode-graphql
Allow different schemas for different file paths
- Dominant language
- TypeScript
- Stars
- 78
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Example use case:
Next.js app where the API routes can call the graphql API as admins vs the frontend that can call the API as authenticated users.
Example config from graphql-code-generator config which allows a similar behaviour:
module.exports = {
generates: {
'./types/codegen/index.ts': {
schema: [
{
[`https${process.env.NEXT_PUBLIC_API_URL}`]: {
headers: {
'X-Hasura-Admin-Secret': XXXXXX,
'X-Hasura-Role': 'User',
},
},
},
],
documents: [
'./pages/**/*.tsx',
'./components/**/*.tsx',
'./utils/**/*.tsx',
],
},
'./types/codegen/admin-generated.ts': {
schema: [
{
[`https${process.env.NEXT_PUBLIC_API_URL}`]: {
headers: {
'X-Hasura-Admin-Secret': XXXXXX,
'X-Hasura-Role': 'Admin',
},
},
},
],
documents: ['./pages/api/**/*.ts'],
},
},
};
┆Issue is synchronized with this [Jira Task](https://apollographql.atlassian.net/browse/NEBULA-1335) by [Unito](https://www.unito.io)
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue provides a GraphQL Code Generator configuration example with separate schemas and document globs for frontend and admin paths. No repository files, tests, entry points, or acceptance criteria are named; first locate the extension's schema and file-path configuration, then establish how separate schemas should be selected and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100