-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Clone schemas #580
Clone schemas #580
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.
lgtm
fixed lint, thanks! |
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. Below one just question.
Would it be better if we just clone it once before passing inside json-schema-resolver? I means clone at L38 / L42
It would behave the same. I can move it if you think it's better. |
Yes, please.
I will do the release work, no need to change the version inside this PR. |
Without the fix the test would have returned a 400 error for the second POST call. This is because running swagger mutates the schema in the global Fastify instance, and breaks the validation.
This fix clones the schema when we load it in the Fastify swagger package and prevents mutation.
Checklist
npm run test
andnpm run benchmark
and the Code of conduct