-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Description
When using fragment arguments with @arguments and @with directives, GraphQL IDE extensions (VS Code GraphQL extension, etc.) report false positive errors like:
Unknown argument "myArg" on directive "@arguments"Unknown argument "myArg" on directive "@with"
The code works correctly - houdini generate succeeds and the app runs fine. The issue is purely with IDE validation.
Reproduction
Fragment definition:
fragment MyFragment on MyType @arguments(includeField: { type: "Boolean", default: false }) {
id
optionalField @include(if: $includeField)
}Query using the fragment:
query MyQuery($includeField: Boolean = false) {
myData {
...MyFragment @with(includeField: $includeField)
}
}Root Cause
The generated schema at .houdini/graphql/schema.graphql defines the directives without argument signatures:
directive @arguments on FRAGMENT_DEFINITION
directive @with on FRAGMENT_SPREADThis is correct behavior since Houdini allows arbitrary arguments dynamically. However, the GraphQL Language Server doesn't understand this pattern and validates strictly against the schema.
Attempted Workarounds (None Working)
We tried the following approaches, but none resolved the IDE validation errors:
-
Disabling validation rules in
.graphqlrc.yaml:extensions: languageService: diagnostics: disable: [KnownArgumentNamesOnDirectives]
-
Adding
.tsfiles to documents config -
Restarting IDE / TypeScript server
None of these suppress the "Unknown argument" errors in the IDE.
Feature Request
Would it be possible to generate the directive definitions with the actual arguments based on what's used in the codebase? For example, after running houdini generate, the schema could include:
directive @arguments(includeField: ArgumentDefinition) on # ... other discovered arguments
FRAGMENT_DEFINITIONOr alternatively, document the recommended .graphqlrc.yaml configuration to suppress these validation errors?
Environment
- Houdini version: 2.0.0-next.11
- Houdini Svelte version: 3.0.0-next.13
- IDE: VS Code/Cursor with GraphQL extension