Skip to content

Revisit YoleckEntityRef's internal optionality #46

@idanarye

Description

@idanarye

Both of YoleckEntityRef's fields are Option:

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default, Debug)]
pub struct YoleckEntityRef {
#[serde(default, skip_serializing_if = "Option::is_none")]
uuid: Option<Uuid>,
#[serde(skip)]
resolved: Option<Entity>,
}

resolved has to be optional, because otherwise we won't be able to deserialize it. But theoretically the uuid should not be optional and instead the YoleckEntityRef can be put inside an Option - because when the uuid is None the resolved is meaningless.

Then again - even though it'd be more correct that way, usability-wise the YoleckEntityRef will have to always be inside an Option - so maybe it's not such a great idea after all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions