Skip to content

Conversation

productdevbook
Copy link
Owner

Summary

  • Fixed GraphQL Document Validation errors when using external services
  • Enhanced scanDocs function to properly filter external service documents
  • Prevents external service queries from being validated against local schema

Problem

External service document files were being incorrectly included in the main client type generation process and validated against the local server schema, causing validation failures when external service queries referenced fields not present in the local schema.

This resulted in errors like:

Cannot query field "countries" on type "Query"
Cannot query field "country" on type "Query"

Solution

Enhanced the scanDocs function in src/utils/index.ts to:

  1. Extract document patterns from configured external services
  2. Filter out files that match external service document patterns
  3. Ensure external service documents are only validated against their respective schemas

Test plan

  • Built the module successfully with pnpm build
  • Tested with Nuxt playground - no more validation errors
  • Confirmed external service types are still generated correctly
  • Verified both local and external GraphQL services work as expected

Impact

  • Resolves client type generation failures when using external GraphQL services
  • Maintains proper separation between local and external service document validation
  • No breaking changes to existing functionality

External service document files were being incorrectly included in the main
client type generation and validated against the local server schema, causing
validation failures when external service queries referenced fields not present
in the local schema.

This fix enhances the scanDocs function to filter out documents that match
external service document patterns, ensuring they are only validated against
their respective external schemas.

Resolves GraphQL Document Validation errors like:
- Cannot query field "countries" on type "Query"
- Cannot query field "country" on type "Query"
@productdevbook productdevbook merged commit 2032a0c into main Aug 26, 2025
1 of 2 checks passed
@productdevbook productdevbook deleted the fix/external-service-document-filtering branch August 26, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant