You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a (recursive) struct/enum with a generic that contains itself in one of its fields. I don't think that can currently be specified using the derive macro.
There have been two issues regarding similar situations:
I have tried using aliases (as shown below), but due to the type itself (and not just its generic C) being in a field this does not work and results in an error in the swagger ui (not exactly the same, as my type was more complex when I took the screenshot):
I think the only way to do this would be manually implementing ToSchema, at which point I'm starting to wonder how useful it is to generate the openapi docs from the Code in the first place.
From what I've understood solving this with type aliases is fundamentally impossible, as it would need one alias in the fields for RuleX and another for PrunedRule. The only other way I can think of solving this would be to use Rule<Rule<Check>> and remove the use of Rule in the enum fields, but I don't really want to do that.
Related question: Is it possible to use utoipa for some things (e.g. the endpoints) and add additional things (e.g. additional schemas) for situations like this where specifying it as yaml is just simpler?
The text was updated successfully, but these errors were encountered:
I have a (recursive) struct/enum with a generic that contains itself in one of its fields. I don't think that can currently be specified using the derive macro.
There have been two issues regarding similar situations:
Rule<Vec<u32>>
and similarI have tried using aliases (as shown below), but due to the type itself (and not just its generic
![2024-02-09-110149_1256x385_scrot](https://private-user-images.githubusercontent.com/8270201/303616572-ea7f3b92-89e4-4487-ba72-cd0c3ae9fd96.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjI4MzksIm5iZiI6MTczOTU2MjUzOSwicGF0aCI6Ii84MjcwMjAxLzMwMzYxNjU3Mi1lYTdmM2I5Mi04OWU0LTQ0ODctYmE3Mi1jZDBjM2FlOWZkOTYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTk0ODU5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Nzg4ZWJkNTE3MjI4ZWIwNjUyZWQzMmNiZjJlNmVlMzM1NDliMzViYjAyOTc2NzAzOTI5OTM0NTFkMzMwMTI5MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Wv6IC5F5yi9uJ0z2ITyzz4HgFU_hv9O6fjrlh32oBQY)
C
) being in a field this does not work and results in an error in the swagger ui (not exactly the same, as my type was more complex when I took the screenshot):I think the only way to do this would be manually implementing ToSchema, at which point I'm starting to wonder how useful it is to generate the openapi docs from the Code in the first place.
From what I've understood solving this with type aliases is fundamentally impossible, as it would need one alias in the fields for RuleX and another for PrunedRule. The only other way I can think of solving this would be to use
Rule<Rule<Check>>
and remove the use ofRule
in the enum fields, but I don't really want to do that.Related question: Is it possible to use utoipa for some things (e.g. the endpoints) and add additional things (e.g. additional schemas) for situations like this where specifying it as yaml is just simpler?
The text was updated successfully, but these errors were encountered: