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
If it's a native type, force inline = true except if #[schema(inline = false)] is specified (because if it is specified, maybe someone does actually want to make their own u32 schema?).
If #[schema(inline = ...)] is specified, use it.
Otherwise, assume #[schema(inline = true)] (in order to keep the existing behavior).
Person<String, Type<MyStruct> will work as expected.
Person<String, Type<i32> will not work, because it will generate an invalid reference to the the i32 schema ("$ref": "#/components/schemas/i32") instead of inlining the i32 schema.
Workaround
To workaround case 2., #[schema(inline)] must be added manually on the nested generic's field(s):
Problem
Follow up on #1182 / #1184
The new behavior for generic types is as follow:
But an edge case remains (cf this comment).
Nested generics need to be inlined manually in some cases.
Here is an example:
In this case:
Person<String, Type<MyStruct>
will work as expected.Person<String, Type<i32>
will not work, because it will generate an invalid reference to the thei32
schema ("$ref": "#/components/schemas/i32"
) instead of inlining thei32
schema.Workaround
To workaround case 2.,
#[schema(inline)]
must be added manually on the nested generic's field(s):To Do
The text was updated successfully, but these errors were encountered: