Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
$ref support - OAS 2.0 compliant #239
$ref support - OAS 2.0 compliant #239
Changes from 2 commits
c36683e
a1ebe92
72d2250
adf995e
15a83cb
2aefca1
cba6c78
2bfeb51
1e16a49
76d0eee
4f2a8da
4440425
f1bb6a6
945d99c
61095a6
3f27e12
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@Eomm, do you know if in v3 this method was reworked, so it will return all schemes, even those what were registered in child scopes with fastify.register?
Cause in fastify v2 I had to go through all child scopes in order to get all of them like https://github.com/SkeLLLa/fastify-oas/blob/master/lib/openapi/index.js#L5
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.
nope, it is encapsulated and tested here:
https://github.com/fastify/fastify/blob/master/test/schema-feature.test.js#L505
I agree that we could think a nicer solution 👍
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 think looping through children is quiet fine, unless you have schemes with same names. But in fastify-oas module there were no such issues, so it can be used.
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.
In think the onRegister hook could let us to avoid to use the symbol, I will give it a try
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.
One more idea - is to add addSchema hook to Fastify. That will allow plugins to get schemes when they are registered. And, for example, instead of resolving them we could put schema to swagger
definitions
whenaddSchema
is called and use$ref
inside swagger route to that definition.