Skip to content

Conversation

@felixfbecker
Copy link
Contributor

PR Summary

As proposed in #7749.

These can be used for autocompletion and validation in editors like VS Code. It makes writing Format and Types files so much more pleasant to write.

autocompletion

The schemas were taken from #7749 but extended with documentation parsed from the reference docs markdown with a script.

Question: Should this be hosted on http://schemas.microsoft.com/ like the MAML schemas? How do the MAML schemas get published there?

cc @lzybkr @SteveL-MSFT

PR Checklist

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

Great contribution! Didn't review the schema itself in detail, but overall it looks fine. We can address as bugs if issues are reported.

Copy link
Member

Choose a reason for hiding this comment

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

.NET Framework is specifically not .NET Core. Since this applies to both, I would suggest just changing all occurrences of .NET Framework to simply .NET

@felixfbecker
Copy link
Contributor Author

@SteveL-MSFT as mentioned, all documentation is 1:1 unmodified from the Format XML schema reference: https://docs.microsoft.com/en-us/powershell/developer/format/format-schema-xml-reference

I can easily update these schemas with new documentation by running the script again, but I don't think it makes sense to apply fixes to the documentation only to the schema? Most people will probably read the docs online. We should decide which one is the source of truth

@SteveL-MSFT
Copy link
Member

SteveL-MSFT commented Sep 20, 2018

@felixfbecker I submitted MicrosoftDocs/PowerShell-Docs#2943 to fix the online documentation. I'm ok leaving the second comment until we add more to the schema. You can wait for that to be merged and rerun your script.

@lzybkr
Copy link
Contributor

lzybkr commented Sep 20, 2018

I like the idea of a single source of truth. Maybe we should include your script in this PR so anyone can update the schemas from the docs.

@felixfbecker
Copy link
Contributor Author

felixfbecker commented Sep 21, 2018

In an ideal world the docs would rather be generated from the schema (there are probably tools out there that do this). Parsing markdown with regexes is really hacky so I'm not sure if we want to rely on that. The current docs are not very well-structured in general so generating them differently would likely do them good.

@SteveL-MSFT your change actually didn't affect my script because it only updated the table of contents, I sent a follow-up PR: MicrosoftDocs/PowerShell-Docs#2944

@felixfbecker
Copy link
Contributor Author

My script also detected many cases in the docs where the schema you gave me @lzybkr directly contradicted the reference docs, e.g. an explicit minOccurs="0" in the schema, but an explicit "This element is required" in the docs. I tried out a few cases by omitting the element, loading the file into PowerShell and checking if it errors, and found that in all cases the docs were wrong. So the docs are a bad single source of truth.

@lzybkr
Copy link
Contributor

lzybkr commented Sep 21, 2018

Generating the markdown does sound easier. It doesn't need to be in this PR, but I do like that idea.

And I don't see ever truly having a single source of truth without generating PowerShell's parser from the xsd - but having done that once before, we'd want the generated code to be much better than what I saw a few years ago.

@felixfbecker
Copy link
Contributor Author

@lzybkr @SteveL-MSFT updated schemas with latest docs, should be good to merge now.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a trailing newline at the end

@SteveL-MSFT
Copy link
Member

@felixfbecker please rebase off master to pick up fixes causing the CI failures

These can be used for autocompletion and validation in editors
@felixfbecker
Copy link
Contributor Author

@SteveL-MSFT all green ✅

@felixfbecker
Copy link
Contributor Author

@adityapatwardhan?

@adityapatwardhan
Copy link
Member

@felixfbecker Sorry for the delay. I will review this today.

@adityapatwardhan adityapatwardhan merged commit 97daeb5 into PowerShell:master Oct 2, 2018
@adityapatwardhan
Copy link
Member

@felixfbecker Thanks for your contribution!

@felixfbecker felixfbecker deleted the xsd branch April 6, 2019 19:49
adityapatwardhan pushed a commit to adityapatwardhan/PowerShell that referenced this pull request Apr 9, 2019
These can be used for autocompletion and validation in editors
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.

4 participants