-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: rename definitions to properties #50
Conversation
hi @Coobaha can you have a look? |
@qwelias oh sorry, missed it - thanks for the ping :) will check soon! |
@qwelias can you please ensure that tests are passing? 🙇 |
yep, my bad, totally forgot about them |
There's still a problem with |
@Coobaha should be good to go now tho realistically it's a breaking change in case anyone used |
@qwelias Thanks for the contribution. Trying to understand the issue and how this PR fixes it. So when On the first look it seems to create new object that it mutates by deletion here https://github.com/fastify/fastify-swagger/blob/47ab4b5caca673b444932f7a45f63a1af15e4ca8/lib/spec/swagger/index.js#L22-L25 swaggerObject.definitions = prepareSwaggerDefinitions({
...swaggerObject.definitions,
...(ref.definitions().definitions)
}, ref) Please correct me if I am wrong or even better pleasee provide stackblitz example with repro. |
@Coobaha https://github.com/qwelias/typed-fastify-test |
@qwelias while i understand that this fixes an issue, to me it seems that this is something that should be fixed in |
I believe it depends on how you fastify.addSchema those definitions. In your case you do just one call with whole schemas object instead of adding each definition separately. I thought about fixing it by adding each definition, but it may introduce conflicts between multiple generated schemas since you can export same type names from different .ts files |
@qwelias i've published latest version (including changes from this PR) https://www.npmjs.com/package/@coobaha/typed-fastify/v/1.0.0-rc.1 Please let me know if you will have any issues :) |
https://github.com/fastify/fastify-swagger/blob/master/lib/spec/swagger/utils.js#L325