DSC icon indicating copy to clipboard operation
DSC copied to clipboard

Need a way to get schema from adapted resources for intellisense

Open SteveL-MSFT opened this issue 6 months ago • 4 comments

Summary of the new feature / enhancement

As part of the Bicep extension work, we need JSONSchema for any type of resource so that we can provide intellisense during authoring experience. Currently dsc simply expects the adapter to validate the input or reject as an error. We need to formalize this so that adapted resources can participate in intellisense.

Proposed technical implementation details (optional)

Initial thinking is that adapters support the schema operation, but have an additional argument for the adapted type and expected to return JSONSchema.

@andyleejordan as you are working on the Bicep extension, how would it work best for your extension?

SteveL-MSFT avatar Jun 07 '25 22:06 SteveL-MSFT

I think the "top" command in the image below is what I think I would have expected to work. dsc resource schema --adapter Microsoft.DSC/PowerShell --resource Microsoft.Windows.Settings/WindowsSettings

Image

denelon avatar Sep 18 '25 23:09 denelon

Ideally, you shouldn't have to specify --adapter in that example - as with invoking the resources, DSC knows which adapter the resource depends on and should route it automatically.

michaeltlombardi avatar Sep 22 '25 14:09 michaeltlombardi

I think this issue essentially covers my ask to have a --all flag for dsc resource list but frankly, like Mikey says, DSC knows which adapters to use for these resources so dsc resource list -o json probably should just list all resources, adapted or not.

andyleejordan avatar Oct 22 '25 20:10 andyleejordan

Now that we are planning to have an adapted.resource.json file that would contain the schema for build time generated adapted resources. For the runtime discovered adapted resources we should have the adapter create a JSON schema on behalf of the resource. At bare minimum it could just set the properties and types but ideally it would also take the [Validate] attributes and convert them into the appropriate JSON schema.

ThomasNieto avatar Nov 04 '25 19:11 ThomasNieto