Skip to content

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

Closed

Description

@JohnLudlow

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.

Activity

  1. JohnLudlow commented on Jun 15, 2017

    @JohnLudlow
    Author

    Realised this is already open in other channels

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

    PowerShell/vscode-powershell#159

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

  2. SteveL-MSFT commented on Jun 15, 2017

    @SteveL-MSFT
    Member

    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.

  3. JohnLudlow commented on Jun 20, 2017

    @JohnLudlow
    Author

    Steve Lee (@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

  4. SteveL-MSFT commented on Jun 20, 2017

    @SteveL-MSFT
    Member

    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).

  5. JohnLudlow commented on Jun 21, 2017

    @JohnLudlow
    Author

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

    Looking forward to PSCore6 being GA 👍

  6. SteveL-MSFT commented on Jun 21, 2017

    @SteveL-MSFT
    Member

    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

  7. travisclagrone commented on Jun 6, 2019

    @travisclagrone

    Any progress on this issue?

  8. added
    WG-Languageparser, language semantics
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Jun 6, 2019
  9. SteveL-MSFT commented on Jul 5, 2019

    @SteveL-MSFT
    Member

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

  10. removed
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Feb 17, 2022
  11. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  12. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreWG-Languageparser, language semantics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions