graphile-engine icon indicating copy to clipboard operation
graphile-engine copied to clipboard

pgIntrospection pgFieldIntrospection for GraphQLInputObjectType:fields:field mutation input hook

Open id3nom opened this issue 4 years ago • 5 comments

Feature description

Add pgIntrospection and pgFieldIntrospection in context.scope for mutation input hook.

Motivating example

Create a file upload plugin that work with postgreSQL function.

Breaking changes

None that I know of.

Supporting development

I [tick all that apply]:

  • [ ] am interested in building this feature myself
  • [ ] am interested in collaborating on building this feature
  • [x] am willing to help testing this feature before it's released
  • [ ] am willing to write a test-driven test suite for this feature (before it exists)
  • [ ] am a Graphile sponsor ❤️
  • [ ] have an active support or consultancy contract with Graphile

id3nom avatar May 20 '21 08:05 id3nom

I think you're asking to add introspection data here:

https://github.com/graphile/graphile-engine/blob/b715f6d1be7dd19e39830b4329fa3c758e5ae91b/packages/graphile-build-pg/src/plugins/makeProcField.js#L635

I'd love a PR for that :+1:

benjie avatar May 24 '21 10:05 benjie

Yes that's what I mean, I successfully have expanded the 'payloadTypeScope' but the 'fieldScope' expansion doesn't work, maybe you can give me a hint on that.

If I find a way to do it I will post a PR with the changes.

id3nom avatar May 25 '21 12:05 id3nom

Probably just adding

            ...payloadTypeScope

after the above line would suffice? If that was raised as a PR I'd also want the variable renamed since it's not just used in the payload any more.

the 'fieldScope' expansion doesn't work

I don't really follow. What do you mean by "doesn't work"?

benjie avatar May 26 '21 12:05 benjie

What I mean is that expanding 'payloadTypeScope' give introspection data on the PostgreSQL function but I'm unable to get introspection data on the arguments.

id3nom avatar Jun 07 '21 13:06 id3nom

Arguments don't have separate introspection; they're part of the function from pg_proc: https://github.com/graphile/graphile-engine/blob/726c210ae6f559c132f859fed18dc031a2a2cb1c/packages/graphile-build-pg/src/plugins/introspectionQuery.js#L75-L79

benjie avatar Jun 07 '21 15:06 benjie