Closed alexborisov closed 2 months ago
Hi,
thanks for asking. Removing items from responses typically happens if fastify sees a response schema that is more strict than the response that is being provided.
Recursive schema should work, see: https://github.com/seriousme/fastify-openapi-glue/blob/master/test/test-recursive.v3.js
Could you make a minimal example based on this test, but then with your object structure to see if that works ?
If that doesn't work then we can debug that to fix the issue, and add it to the test set to avoid regressions.
Kind regards, Hans
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
Hello, I'm trying to debug a problem and identify the source. I have a Schema component "Category". This is an object with a property
parent
which is also a Category. My definition looks like so:I have two endpoints -
getCategoryById
which returns a category object andgetAllCategories
which returns an object with an array of category objects{results: [{...}]}
The first one (
getCategoryById
) returns an object with a correctly nested parent. Everything is resolved and all the data is there. The second case (getAllCategories
) returns an empty object for the parent of every category.If i console log the raw db data nested parents are all there. If i change the definition of parent in my Category schema from:
to
The response to
getAllCategories
comes back with the parent object present and populated.At first i thought it might be some sort of recursion protection, but in that case i should be getting an empty object for both use cases... so this makes me think it might be a bug given how this only applies to arrays of objects.
Please help! 🥺