PowerShell / PowerShell/DSC

Resource DevX: Enable rust projects to reuse canonical properties

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

Nobody has claimed this yet.

Issue-Enhancement Needs Triage
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

Summary of the new feature / enhancement

As a rust developer implementing a DSC Resource, I want to be able to reuse the definition for canonical properties in my resources without having to check the implementation in DSC and copy it into my projects, so that I can reduce the effort required to participate in DSC's semantics.

For example, implementing a resource with the _exist property requires me to define the struct field, rename it, define the default as true, and set the JSON schema as a reference to the canonical schema for the property. This also applies to resources implementing metadata for returning what-if messages and so on.

Proposed technical implementation details (optional)

I'm not familiar enough with rust to know what the right workaround is, but it doesn't seem like rust supports inheritance in structs. In go, I would use struct embedding for this purpose, but the way to do this in rust seems like using a macro or attributes, which is beyond my current expertise to propose usefully.

I think this also speaks to the (eventual, post v3.0.0 stable release) need for development kit libraries - being able to define a struct something like:

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)]
#[serde(deny_unknown_fields)]
#[schemars(
  title = "TailspinToys/TSToy"
  description = "Manage the machine and user scope TSToy application configuration files"
)]
pub struct TSToy{
  #[dsc(canonical_property)]
  exist: dsc::properties::exist
  // specific properties for this resource
}

And having it get all of the right things

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 files or tests are named. Start by locating the Rust resource definitions and the existing canonical property and JSON schema implementations for _exist and what-if metadata. Done means resource authors can reuse those definitions without copying field, default, schema, or metadata implementation details.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.