-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: allow reusing resolvers #23
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
base: main
Are you sure you want to change the base?
feat: allow reusing resolvers #23
Conversation
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.
Please add a test for this export as well as the types.
The types tests live in:
https://github.com/fastify/merge-json-schemas/blob/main/types/index.test-d.ts
Docs are also needed |
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.
lgtm
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.
Pull Request Overview
This PR exports the resolver functions to allow users to reuse them easily instead of resorting to copy-pasting or hacky imports.
- Exports the resolvers from index.js
- Updates type tests to verify resolver types
- Adds unit tests and README documentation to demonstrate usage
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
File | Description |
---|---|
types/index.test-d.ts | Updated import and type tests to ensure exported resolvers work |
test/exports.test.js | New tests verifying the resolvers export and type function |
index.js | Modified export to include resolvers |
README.md | Documentation updated with an example of resolver usage |
Signed-off-by: Frazer Smith <[email protected]>
@ivan-tymoshenko wdyt? |
Hi @ivan-tymoshenko — just a gentle nudge on this one. The merge is currently blocked and I’ve already got two approvals. Could you please take a look when you get a moment? Appreciate your help! |
This PR exports resolver functions so we can reuse them. Let me give you an example:-
I wanted to use arraysUnion on enum keyword. But the only option I had was to either
(here CustomResolvers is the module I created in my repo where I've copy pasted your arraysUnion function)
But now, after this change, on exporting resolvers, it makes your resolver functions re-usable. Hence I could do something like below, which is very intuitive and reduces boilerplate code for someone using the lib:-
Checklist
npm run test
andnpm run benchmark
and the Code of conduct