stackabletech / stackabletech/operator-rs

Feat: Add test deserialize helper

Open
#712 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
167
Forks
19
Avg merge
1d 6h
Merged PRs (30d)
9

Description

    /// 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>);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test entry point is named. Start by locating the repository's test helpers and inspect how YAML deserialization is currently performed; done means a reusable Rust helper applies singleton_map_recursive and the shown AuthenticationClass usage compiles and passes the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.