Skip to content

Exporting an endpoint with no mutations #3075

@itai-asf

Description

@itai-asf

When trying to export an endpoint that has no mutations, graphql-tools crashes while trying to parse and create the schema.
For example a DB using postgraphile that is exporting not tables, only a view.

To reproduce the bug:

  1. Create a postgres db with some tables.
  2. Create a postgres view.
  3. Omit all the tables using "@omit read,update,create,delete,all,many" (https://www.graphile.org/postgraphile/smart-tags/#the--character)
  4. Run graphql-tools

I am using graphql-mesh and it crashes when graphql-tools is trying to create the schema:
`

start
graphql-mesh serve

🕸️ => ⠋ Generating Mesh schema...GraphQL Mesh Configuration is not valid:
data/sources/0/handler/postgraphile must NOT have additional properties
🕸️ => ✖ Unable to start GraphQL Mesh: Cannot convert undefined or null to object
`

The expected behaviour should be ignoring the case of having no mutations and parsing only the queries.

Workaround:
Creating a simple table with no data (so you won't be afraid to export it). Don't omit the operations on this table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting-for-releaseFixed/resolved, and waiting for the next stable release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions