pg_graphql icon indicating copy to clipboard operation
pg_graphql copied to clipboard

Invalid query is not rejected

Open imor opened this issue 2 years ago • 0 comments

Describe the bug A query which doesn't specify any subfields on a non-scalar field should be rejected.

To Reproduce

Run the following SQL:

create table account(
    id serial primary key,
    email varchar(255) not null
);

select jsonb_pretty(graphql.resolve($$
    query {
        accountCollection
    }
$$));

Observe that the above GraphQL query returns:

           jsonb_pretty
-----------------------------------
 {                                +
     "data": {                    +
         "accountCollection": null+
     }                            +
 }
(1 row)

Expected behavior The query should be rejected with an error message because the accountCollection field has id and email sub-fields.

Screenshots If applicable, add screenshots to help explain your problem.

Versions:

imor avatar Sep 06 '23 06:09 imor