Skip to content

Feat: Add test deserialize helper #712

Description

@fhennig
    /// Helper function to deserialize objects with serde. We need this 'singleton_map_recursive' thing, otherwise
    /// untagged enums will not deserialize correctly.
    fn deserialize<'de, T: stackable_operator::k8s_openapi::serde::Deserialize<'de>>(
        input: &'de str,
    ) -> T {
        let deserializer = serde_yaml::Deserializer::from_str(input);
        serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap()
    }

usage:

let auth_class: AuthenticationClass = deserialize(<your string here>);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions