Skip to content

Conversation

@michaeltlombardi
Copy link
Collaborator

PR Summary

Important

This PR depends on #1309 and will remain in draft until that PR is merged.

Prior to this change, the resource manifest, extension manifest, and configuration document structs in dsc-lib manually implemented the DscRepoSchema trait.

This change uses the new macro to derive the trait on those types and other types in the library that currently map to schema files. This change also makes an effort to correctly annotate types that aren't covered by the separate schemas, but as not all types map to a schema file, these changes don't fully cover all types that derive the JsonSchema trait.

This change prepares the library for further canonicalization steps to steer the generated schemas towards the definitions in the canonical schemas.

PR Context

@michaeltlombardi michaeltlombardi force-pushed the gh-538/main/dsc_repo_schema_trait_macro branch 2 times, most recently from 56ade57 to 136c9f8 Compare December 10, 2025 16:35
Prior to this change, the resource manifest, extension manifest, and
configuration document structs in `dsc-lib` manually implemented the
`DscRepoSchema` trait.

This change uses the new macro to derive the trait on those types and
other types in the library that currently map to schema files. This
change also makes an effort to correctly annotate types that aren't
covered by the separate schemas, but as not all types map to a schema
file, these changes don't fully cover all types that derive the
`JsonSchema` trait.

This change prepares the library for further canonicalization steps to
steer the generated schemas towards the definitions in the canonical
schemas.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the DSC library to use a derive macro for implementing the DscRepoSchema trait instead of manual implementations. The changes replace verbose, repetitive trait implementations with concise derive macro annotations across resource manifests, extension manifests, configuration documents, and numerous supporting types throughout the library.

Key Changes:

  • Replaced manual DscRepoSchema trait implementations with the #[derive(DscRepoSchema)] macro for Configuration, ResourceManifest, and ExtensionManifest types
  • Added DscRepoSchema derive annotations to ~40 additional types that map to schema files (enums for capabilities, result types, method definitions, etc.)
  • Removed obsolete imports (UnrecognizedSchemaUri, json_schema) from main module scopes while preserving them in test modules

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/dsc-lib/src/functions/mod.rs Added DscRepoSchema derives to FunctionArgKind, FunctionDefinition, and FunctionCategory with appropriate schema metadata
lib/dsc-lib/src/extensions/secret.rs Applied DscRepoSchema derive to SecretMethod with schema path annotation
lib/dsc-lib/src/extensions/import.rs Applied DscRepoSchema derive to ImportMethod with schema path annotation
lib/dsc-lib/src/extensions/extension_manifest.rs Replaced 26-line manual trait implementation with derive macro and schema field configuration for ExtensionManifest; cleaned up imports
lib/dsc-lib/src/extensions/dscextension.rs Added DscRepoSchema derives to DscExtension and Capability enum with schema metadata
lib/dsc-lib/src/extensions/discover.rs Applied DscRepoSchema derives to DiscoverMethod and DiscoverResult with appropriate schema paths
lib/dsc-lib/src/dscresources/resource_manifest.rs Replaced manual implementation with derive macro for ResourceManifest and added derives to 13 supporting types (Kind, ArgKind, InputKind, method types, etc.)
lib/dsc-lib/src/dscresources/invoke_result.rs Added DscRepoSchema derives to 9 result types (GetResult, SetResult, TestResult, and their variants)
lib/dsc-lib/src/dscresources/dscresource.rs Applied DscRepoSchema derives to DscResource and resource Capability enum
lib/dsc-lib/src/configure/config_result.rs Added DscRepoSchema derives to 7 result types including ResourceMessage and configuration operation results
lib/dsc-lib/src/configure/config_doc.rs Replaced manual implementation with derive macro for Configuration and added derives to 13 supporting types (metadata, parameters, functions, output types, etc.)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant