Powershell: Suggestion: Allow a .psd1 to have a schema so that validation and intellisense can be done

Created on 15 Jun 2017  路  8Comments  路  Source: PowerShell/PowerShell

In PowerShell it's possible to use a .psd1 file to provide data to a cmdlet. DSC does this for example with its configuration data.

We are developing a module which deals with environment preparation and configuration. It takes a configuration file (.psd1) which contains the required information about the environment.

This could be quite a bit of information so we do plan to use plenty of documentation to tell the users what the file should look like and runtime validation to point out errors. However, it struck me that it would be a nice idea to be able to apply a schema in a similar fashion to XML and JSON schemas. If an editor understands the schema, then it can show intellisense and flag errors.

And it also means that the cmdlet can check for errors by running the schema validation and give consistent errors.

JSON schemas work by adding a $id to the root element which specifies a schema URI.

Issue-Enhancement Up-for-Grabs WG-Language

Most helpful comment

I plan to have a blog post in the near future (let's say in July sometime) that discusses our plan to get to a release candidate and relationship with Windows PowerShell 5.x

All 8 comments

Realised this is already open in other channels

https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/13585962-provide-intellisense-template-for-manifests

https://github.com/PowerShell/vscode-powershell/issues/159

However, I couldn't find one in this repo and this seems like the place for it...

The direction we're heading is to support DSLs (Domain Specific Langauges) in PowerShell. This way they become first class citizens with validation and intellisense support. This is targeted for 6.1.0, however.

@SteveL-MSFT Sorry for the delay in reply.

That's good news. Now, when you say it will be in 6.1.0, 6.x is PowerShell Core, and WMF will be 5.x forever, right? Will PowerShell Core become standard on Windows, or will this feature be ported into a WMF 5.x branch?

Thanks

@JohnLudlow current plan is to not port any features to Windows PowerShell 5.x and to make PSCore6 a suitable replacement for Windows PowerShell. At this time, we don't have a plan to ship PSCore6 in-box (presumably side-by-side with 5.x for compat reasons rather than replacing), although this is something we'll have to resolve as we get closer to PSCore6 GA (General Availability, aka, the new RTM).

Ok, thanks for the clarification - some earlier communication on that was a little confusing.

Looking forward to PSCore6 being GA 馃憤

I plan to have a blog post in the near future (let's say in July sometime) that discusses our plan to get to a release candidate and relationship with Windows PowerShell 5.x

Any progress on this issue?

@travis-c-lagrone sorry, no progress on this specific issue

Was this page helpful?
0 / 5 - 0 ratings