Skip to content
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

Merged
merged 4 commits into from
Apr 13, 2022
Merged

Clone schemas #580

merged 4 commits into from
Apr 13, 2022

Conversation

amit-kleiner
Copy link
Contributor

@amit-kleiner amit-kleiner commented Apr 12, 2022

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

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@amit-kleiner
Copy link
Contributor Author

fixed lint, thanks!

Copy link
Member

@climba03003 climba03003 left a 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

@amit-kleiner
Copy link
Contributor Author

amit-kleiner commented Apr 13, 2022

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.
Also, should I bump the version to 5.1.1?

@climba03003
Copy link
Member

It would behave the same. I can move it if you think it's better.

Yes, please.

Also, should I bump the version to 5.1.1?

I will do the release work, no need to change the version inside this PR.

@climba03003 climba03003 merged commit 20a5d12 into fastify:master Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants