ardatan / ardatan/graphql-import

add directives definitions to import?

Open
#201 5 comments 0 reactions 0 assignees View on GitHub
bug waiting for answer
Dominant language
No language data
Stars
864
Forks
53
PR merge metrics
No merged PRs in 30d

Description

I have an app that parses schemas and is processing them.

I want to use a directive in these schemas, but not to write there it's definition (alike Prisma directives in datamodel). But I can't run import these schemas:
```
Error: Directive relation: Couldn't find type relation in any of the schemas.
at collectDirective (.../node_modules/graphql-import/src/definition.ts:172:15)
at Array.forEach ()
at collectNode (.../node_modules/graphql-import/src/definition.ts:161:21)
at .../node_modules/graphql-import/src/definition.ts:135:7
at Array.forEach ()
```
`graphql-import` only works if I supply path to schema, not the schema content, so I can't simply concat directive definition during import.

So is there a way to overcome this? To add definitions during import? Or make it simply to ignore absence of relation

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/definition.ts at collectDirective and collectNode, using the reported error path to trace how imported schema definitions are checked. Determine how schema content and directive definitions are currently supplied, then define and test completion as either accepting additional directive definitions during import or intentionally ignoring an absent relation directive.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.