Open chunleng opened 4 weeks ago
Did a little testing locally and found out that the autogenerator might be a little off:
According to serde library: https://serde.rs/enum-representations.html#internally-tagged
When using #[serde(tag = "node_type")]
, the relevant field should not appear in the enum item's struct, however, the
autogenerator seems to have included node_type
in the item, causing the deserialize to fail
// https://github.com/ory/client-rust/blob/10027729688da0967e45cf7d7e1b8a1ec5ea8173/src/models/ui_node_attributes.rs#L16
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "node_type")]
pub enum UiNodeAttributes {
#[serde(rename="input")]
Input(Box<models::UiNodeInputAttributes>),
...
}
// https://github.com/ory/client-rust/blob/10027729688da0967e45cf7d7e1b8a1ec5ea8173/src/models/ui_node_input_attributes.rs#L16
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UiNodeInputAttributes {
...
/// NodeType represents this node's types. It is a mirror of `node.type` and is primarily used to allow compatibility with OpenAPI 3.0. In this struct it technically always is \"input\". text Text input Input img Image a Anchor script Script
#[serde(rename = "node_type")]
pub node_type: NodeTypeEnum,
...
}
One method to resolve is to remove node_type
field from the struct of UiNodeXXXAttributes
(e.g. UiNodeInputAttributes
, etc.)
Preflight checklist
Ory Network Project
No response
Describe the bug
While using
create_native_registration_flow
, I ran into the following bug:It seems to have occurred once before in https://github.com/ory/sdk/issues/325 and appeared again
Reproducing the bug
Run the following code:
Relevant log output
Relevant configuration
No response
Version
Kratos 1.3.0
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
Docker Compose
Additional Context
docker image: oryd/kratos:v1.3.0 cargo: