-
Notifications
You must be signed in to change notification settings - Fork 2k
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
introduce simple user provided caches for parse/validate #4285
Conversation
BREAKING CHANGE: parse/validate become potentially async when provided with a cache with an async getter, Introduces parseSync/validateSync to throw when an async value is returned. Updates all non-cache tests to use parseSync/validateSync.
✅ Deploy Preview for compassionate-pike-271cb3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't think an opinion like this fits the reference implementation, the inputs to the cache also suffer from a lot of short-comings. For one a lot of caches would require contextual input, i.e. does this user even have access to this part of the schema which informs how the cache key looks.
I would prefer us altering the signature as suggested in the issue and discuss this on existing PR's rather than superseding them verbatim 😅
This seems to be a separate bit of feedback, so I think it makes sense to address it directly. I agree that it's debatable as to whether a caching system need be provided within the reference implementation vs user land. I think it's reasonable to bring it into the reference implementation, with the plus-side in that it allows for caching without advanced plugin frameworks. A negative would be the potential maintenance burden. I think the balance between these is pretty neutral in this case.
In terms of parsing, I am not sure yet how a In terms of validation, I can definitely imagine user-specific validation rules. These cache objects, however, are service-supplied, with the service able to provide custom functions that have all the requisite information if there are indeed different user-facing requirements.
I am not comfortable with artificially changing the return type of these functions. I outlined a different approach a long while back on the linked issue (#3421 (comment)) which I framed at the time as a way to help in a non-breaking way, but that I now prefer for more fundamental reasons. |
Closing, will possibly rework into a general pipeline function that can use the withCache wrapper or something similar. |
BREAKING CHANGE: parse/validate become potentially async when provided with a cache with an async getter,
Introduces parseSync/validateSync to throw when an async value is returned.
Updates all non-cache tests to use parseSync/validateSync.