Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource DevX: Enable rust projects to reuse well-known properties #570

Open
michaeltlombardi opened this issue Oct 9, 2024 · 0 comments
Labels
Issue-Enhancement The issue is a feature or idea Needs Triage

Comments

@michaeltlombardi
Copy link
Collaborator

Summary of the new feature / enhancement

As a rust developer implementing a DSC Resource, I want to be able to reuse the definition for well-known 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(well_known_property)]
  exist: dsc::properties::exist
  // specific properties for this resource
}

And having it get all of the right things

@michaeltlombardi michaeltlombardi added Issue-Enhancement The issue is a feature or idea Needs Triage labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement The issue is a feature or idea Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant