poem
poem copied to clipboard
Union doesn't implement `IsObjectType`
Expected Behavior
https://github.com/poem-web/poem/compare/master...vpikulik:poem:union_is_object_type
Actual Behavior
$ -> cargo check
Checking example-openapi-union v0.1.0 (/Users/promo/wd/poem/examples/openapi/union)
error[E0277]: the trait bound `MyObj: IsObjectType` is not satisfied
--> openapi/union/src/main.rs:25:8
|
25 | My(MyObj),
| ^^^^^ the trait `IsObjectType` is not implemented for `MyObj`
|
= help: the following other types implement trait `IsObjectType`:
A
B
note: required by a bound in `<TopObj as Type>::register::{closure#0}::_::{closure#0}::assert_impl_all`
--> openapi/union/src/main.rs:22:10
|
22 | #[derive(Union, Debug, PartialEq)]
| ^^^^^ required by this bound in `assert_impl_all`
= note: this error originates in the macro `poem_openapi::__private::static_assertions::assert_impl_all` which comes from the expansion of the derive macro `Union` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `example-openapi-union` (bin "example-openapi-union") due to 1 previous error
Steps to Reproduce the Problem
- switch to https://github.com/poem-web/poem/compare/master...vpikulik:poem:union_is_object_type
-
cd poem/examples/openapi/union
-
cargo check
Specifications
- Version: rustc 1.77.2
- Platform:
- Subsystem:
How to solve
impl IsObjectType for MyObj {}
solves the problem
Should it be added to Union
derive macro?