apollographql / apollographql/apollo-tooling

Apollo Codegen neither should ignore errors in gql queries nor skip bad queries

Open
#979 4 comments 9 reactions 0 assignees View on GitHub
🤖 component - codegen
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

This query contains syntax error: there should be `$` before `language`
```
const similarMoviesQuery = gql`
query SimilarMovies($id: Int!, language: Language!) {
...
}`;
```

When to run `apollo codegen`, it skips this file and does not generate TypeScript interfaces for it.
✔ Loading Apollo Project
✔ Generating query files with 'typescript' target - wrote 5 files (**should be 6**)

**No errors and no warnings...** It does not create types for this query.

**Expected** that some error/warning appears in the console if query/mutation contains syntax error etc.

Contributor guide

Open the contributing guide

Research direction

Start with the `apollo codegen` command and trace how the shown invalid GraphQL query is parsed and skipped. Reproduce the example, then add coverage for the invalid query path so codegen reports an error or warning instead of silently omitting generated types.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.