[useResponseCache] Ignore specfic schemaCoordinates for IdFields which are not the root of a subgraph
🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.
Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.
Description
Add a new optionalList of schemaCoordinates to the useResponseCacheParamters, which is used to exclude fields on specific objects in the mapSchema step.
Fixes #2247
Type of change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
Screenshots/Sandbox (if appropriate/relevant):
N/A
How Has This Been Tested?
Testet fix first on our case and environment by maintaining a parallel instance of this plugin. Further added Unit tests to first reproduce the Issue and proof the fix works.
- [x] Added Test "'id field in body overwritten and request fails'"
- [x] Added Test "'id field in body is returned as is and not overwritten'"
Test Environment:
- OS: macOs: Sonoma 14.5
-
@envelop/response-cache: 6.2.0 - NodeJS: 10.5.0
Checklist:
- [ x] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [ x] I have performed a self-review of my own code
- [x] I have commented on my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
Further comments
N/A
⚠️ No Changeset found
Latest commit: 45271af22e7b8f0eab2b4f9fde7d60f1220a22ae
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@ardatan is anythign missing ? Should the changeset be created by me ?
@EmrysMyrddin Could you review?
Hi, I'm not entirely against this feature, but I'm afraid we are introducing it to workaround an actual bug. I'm not sure to entirely understand what is happening here. We should probably first investigate why the plugin behave like this.
@EmrysMyrddin how would you suggest to move forward ? From my expierience/debugging suggestion the plugin identifies every object with an "id" field (configurable) as a cachable entity from a subgraph. If Subgraph A returns a value containing a field with an "id", the plugin seems to remove this part of the resonse while stitching the response together from a non existing subgraph B. Therefore setting the field to null.