Skip to content

Invalid document breaks compilation, shows wrong output #7765

@sarink

Description

@sarink

When working in a monorepo and using the following standard configuration:

schema: api/src/resolvers/**/*.ts

generates:
  api/src/api-types.ts:
    plugins:
      - typescript
      - typescript-resolvers

  web/src/web-types.ts:
    config:
      documents: web/src/**/*.tsx
    plugins:
      - typescript
      - typescript-operations

If a valid but breaking change is made to an api resolver, the entire compilation process will error when trying to generate the web-types, and the new api-types will never get created.

This is a confusing workflow for a backend developer, since the output shows:

  ✔ Parse configuration                                                                                                                                                                                                                                      
  ❯ Generate outputs
    ✔ Generate api/src/api-types.ts   <-- This is a lie
    ❯ Generate web/src/web-types.ts
      ✔ Load GraphQL schemas
      ✔ Load GraphQL documents
      ✖ Generate
        →     at web/src/pages/Home.tsx:3:5

I believe the tool should output whatever it can, regardless of other errors it encounters (that is, do what the output says it does). Is this expected behavior?

I'm not completely sure, but might this have something to do with using Promise.all on this line? Instead, Promise.allSettled would ensure to not throw on the first error

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreRelated to codegen core/clistage/1-reproductionA reproduction exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions