-
Notifications
You must be signed in to change notification settings - Fork 354
Introduce Bare mode to filter-schema transform #1624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: c5efe6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks @santino! Could you fix the tests so we can merge this? |
|
Will do, I also want to address documentation, hence if you're happy to merge #1554 first, I will then build on top of what was added there for Or we can merge both as-is and I will raise a separate PR specifically for documenting the two different modes cross-transform. |
|
Ok, will follow this approach for this PR as well. However, do notice that there is still (currently) another breaking change proposed here for filtering ars: # current
- Query.{user(!pk),book}
- Query.{user(!{pk, name}),book}
# new
- Query.user.!pk
- Query.user.!{pk, address*} |
|
@santino If you mention this breaking change in the changeset, I think it is fine :) |
9d4ace9 to
8a5b8e5
Compare
hence accepting array of strings as config
this introduces a breaking change but simplifies code significantly
|
@ardatan, this is all complete now.
Hope that's all required in order to merge this. |
|
cc @ntziolis |
In order to continue extending
barefunctionalities for Mesh sources, I'm raising this PR for the "filter-schema" transform.The motivation and context are the same as per #1554; which introduces the same functionalities to the "rename" transform.
Breaking changes
There are two breaking changes in this PR, the first is mandatory and already discussed and approved for the "rename" transform. The second is a proposal and we can get to an agreement here before finalising.
filtersproperty. This is because I had to add an object to the transform config in order to supportmode, so the list of rules must also belong to an object propertyThe new syntax for arguments is as follows.
Argument filtering is working well with the above declarative syntax.
The downside of the proposed syntax is that you need one string for each field you want to filter arguments on.
For clarity, this is how the proposed solution differ from the current syntax below, introduced in #1498:
The existing syntax is potentially useful when you're whitelisting fields and you want to filter arguments for those whitelisted fields in a single line.
However, I see a few problems with that:
Query.user(!pk), you will be implicitly whitelisting only theuserfield onQuerytype. This will probably not be expected.!to exclude. My proposal does not introduce any new syntax, which makes it consistent."!User". For fields only rules you specify type and field:Query.{user, posts}. For args you would expect to follow the relationship declaration pattern and specify type, field, and arg; like my proposal:Query.user.!{id, name}.Next steps
The PR is fully functional.
I am seeking agreement on the breaking changes in order to apply the suggested syntax for filtering arguments to the default
wrapmode (which currently has not changed).Potentially we can also consider baking into this PR the change I proposed in #1605. I think it can help potential issues with a more declarative syntax for types, but I'm not too strong about it, so is really up to you.
The only thing to add is the documentation. The restrictions of using
bareare the same already explained in the "rename" transform PR, and are available here.As such, I would suggest merging #1554 first; so that I can then adjust the introduced documentation accordingly.
Checklist: