Created relation field is not optional
Closed this issue · 4 comments
Hi, first thanks for taking the time to develop this plugin. I'm seeing an issue where I have a 1:many relationship. The problem I'm encountering is that the nested mutation field on the create (and possibly update, didn't test) seems to be required. If I don't include the nested mutation field on the create of the primary entity, the plugin throws errors. If you need me to, I can add the plugin back into the project and provide more details on the error (stack, etc..). Thanks.
I've done a bit of refactoring and added support for composite keys today, but check the README.md because there are some breaking changes in field naming to accomodate that. Please try again with 1.0.0-alpha.7 and let me know!
Thanks for the quick response. I'm running into another issue now. I'm not sure if it's related to this plugin or another plugin I'm using: https://github.com/graphile-contrib/postgraphile-plugin-connection-filter.
Here's the error:
Input Object type SubscriptionDataFiltersSubscriptionIdFkeySubscriptionsConnectInput must define one or more fields.
at assertValidSchema (node_modules/graphql/type/validate.js:82:11)
at validate (node_modules/graphql/validation/validate.js:58:35)
at extractQuerySelectionSet (node_modules/graphql-binding/dist/info.js:101:18)
at buildInfoFromFragment (node_modules/graphql-binding/dist/info.js:75:23)
at Object.buildInfo (node_modules/graphql-binding/dist/info.js:17:16)
at Binding.Delegate.delegateToSchema (node_modules/graphql-binding/dist/Delegate.js:140:27)
at Binding.<anonymous> (node_modules/graphql-binding/dist/Delegate.js:64:44)
at step (node_modules/graphql-binding/dist/Delegate.js:32:23)
at Object.next (node_modules/graphql-binding/dist/Delegate.js:13:53)
at /node_modules/graphql-binding/dist/Delegate.js:7:71
I have two tables:
CREATE TABLE subscriptions (
id uuid DEFAULT uuid_generate_v4(),
....
PRIMARY KEY (id)
);
CREATE TABLE subscription_data_filters (
subscription_id uuid NOT NULL,
service_id varchar(50) NOT NULL,
name varchar(50) NOT NULL,
val varchar(50) NOT NULL,
PRIMARY KEY (subscription_id, service_id, name, val),
FOREIGN KEY (subscription_id) REFERENCES subscriptions (id)
);
It looks like the postgraphile-plugin-connection-filter
plugin is trying to add filter arguments to the nested mutation field that this plugin creates? I'm thinking I should maybe open a corresponding issue for the postgraphile-plugin-connection-filter
plugin?
This should be fixed now -- it was a bug where the primary keys weren't properly being added as fields to the Connect
input type when there were multiple keys. I've published 1.0.0-alpha.8 to npm with the fix.
Thanks for being so responsive. Working perfectly now.