Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

allow fields with @requires directive to have their own inputs #47

Closed
wants to merge 18 commits into from

Conversation

mac2000
Copy link

@mac2000 mac2000 commented Sep 14, 2020

If we have something as simple as:

extend type Acme @key(fields: "id") {
  id: ID! @external
  age: Int @external
  foo: String @requires(fields: "age")
}

everything works as expected, but if we gonna need to have some inputs on our foo field then nothing will work, e.g.:

extend type Acme @key(fields: "id") {
  id: ID! @external
  age: Int @external
  foo(someInput: String): String @requires(fields: "age")
}

will produce sdl where foo field wont have @requires directive

thats why we gonna need this (\([^\)]*\)\s*)? addition to regexp to allow optional arguments

change of [\S\s]*? is needed because previous change will start changing schema for each run and regexp wont catch next fields

Integration test is added to prevent regression in future

@tcleonard
Copy link

The approach with this regular expression is quite fragile... I submitted a bit of a revamped approach in the pull request #52 that solve your issue (I even added your exact problem as a unit test)

@mac2000
Copy link
Author

mac2000 commented Oct 29, 2020

@tcleonard agree, but at moment my wish was not to rewrite it but to solve an issue, in either case PR is month old and seems like there is no activity, hopefully your contribution will be more luckily

@chinskiy
Copy link
Member

Hello folks ,

This repository is going to be archived

Further development of graphene-federation will be at https://github.com/graphql-python/graphene-federation
Please address your further pull requests and issues there

Best regards

@chinskiy chinskiy closed this Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants