Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(AB#118304) Add reference docs for command-based resources #181

Conversation

michaeltlombardi
Copy link
Contributor

@michaeltlombardi michaeltlombardi commented Aug 23, 2023

PR Summary

This change adds reference documentation for the proof-of-concept prototype command-based DSC Resources Microsoft/OSInfo and Microsoft.Windows/Registry.

The reference documentation proposes a structure for the reference documentation for command-based resources based on the reference documentation used for the PSDscResources in v2.

It also documents the command-line tools the resources use.

While these commands and resources are not production-ready, they are the only command-based resources we can reference in the documentation at this time. If the resources are removed or replaced in the future, the documentation can be updated.

This change:

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributors guide.
  • Style: This PR adheres to the style guide.

@learn-build-service-prod

This comment was marked as outdated.

@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from 04bed6c to 4e107f2 Compare August 23, 2023 21:39
@learn-build-service-prod

This comment was marked as outdated.

@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from 4e107f2 to a5c06f8 Compare August 23, 2023 21:41
@learn-build-service-prod

This comment was marked as outdated.

@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from a5c06f8 to c85d1ab Compare August 23, 2023 21:45
@learn-build-service-prod

This comment was marked as outdated.

@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from c85d1ab to eb8fbef Compare August 24, 2023 13:40
@learn-build-service-prod

This comment was marked as outdated.

@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from eb8fbef to 73fa72c Compare August 24, 2023 13:48
@learn-build-service-prod

This comment was marked as outdated.

This change adds reference documentation for the proof-of-concept
prototype command-based DSC Resources `Microsoft/OSInfo` and
`Microsoft.Windows/Registry`.

The reference documentation proposes a structure for the reference
documentation for command-based resources based on the reference
documentation used for the PSDscResources in v2.

It also documents the command-line tools the resources use.

While these commands and resources are not production-ready, they are
the only command-based resources we can reference in the documentation
at this time. If the resources are removed or replaced in the future,
the documentation can be updated.

This change:

- Fixes AB#118304
- Fixes AB#118305
- Fixes AB#118306
@michaeltlombardi michaeltlombardi force-pushed the ab-118304/main/registry-osinfo-reference branch from 73fa72c to 74de31a Compare August 24, 2023 14:12
@learn-build-service-prod
Copy link

Learn Build status updates of commit 74de31a:

✅ Validation status: passed

File Status Preview URL Details
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/cli/osinfo.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/examples/osinfo.config.dsc.yaml ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/examples/validate-in-a-configuration.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/examples/validate-with-dsc-resource.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/overview.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/osinfo/resource.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/config/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/config/get.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/config/set.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/config/test.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/find/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/query/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/registry.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/remove/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/schema/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/set/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/cli/test/command.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/Add-RegistryKey.ps1 ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/configure-registry-keys-and-values.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/manage-a-registry-key.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/manage-a-registry-value.md ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/registry.config.dsc.yaml ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/Remove-RegistryKey.ps1 ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/Remove-RegistryValue.ps1 ✅Succeeded View (dsc-3.0)
dsc/docs-conceptual/dsc-3.0/reference/microsoft/windows/registry/examples/Set-RegistryValue.ps1 ✅Succeeded View (dsc-3.0)

This comment lists only the first 25 files in the pull request.
For more details, please refer to the build report.

For any questions, please:

@sdwheeler sdwheeler merged commit 4368cce into MicrosoftDocs:main Aug 24, 2023
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Aug 24, 2023
This change updates the `Microsoft/OSInfo` resource based on the work
for documenting it in MicrosoftDocs/PowerShell-Docs-DSC#181

This change:

- Minimally modifies the README for grammar and formatting.
- Adds docs strings to the types in the source code.
- Adds a canonical schema for the resource, and a YAML version of the
  schema for easier reading and maintaining.
- Updates the resource manifest to embed the canonical schema and to
  add the `url` property to point to the canonical schema.

The canonical schema is generated from the YAML version using the
following command:

```powershell
$YamlPath = Resolve-Path -Path .\schemas\resources\Microsoft\OSInfo\v0.1.0\schema.yaml
| Select-Object -ExpandProperty Path
$JsonPath = $YamlPath -replace '\.yaml$', '.json'

$Schema       = Get-Content -Raw -Path $YamlPath | ConvertFrom-Yaml
$Schema.'$id' = $Schema.'$id' -replace '\.yaml$', '.json'

$Schema
| ConvertTo-Json -Depth 100
| Out-File -Encoding utf8 -Path $JsonPath -Force
```

The schema uses the first sentence from the documentation as the value
for the `description` keyword for each property, replacing backticks
with single quotes, as the `description` keyword doesn't reliably
render as Markdown for editors that support hover help for JSON
schemas. After every description string is the link to that property in
the documentation.

The `markdownDescription` is a non-standard keyword supported by the
JSON and YAML language servers in VS Code. When it is a non-empty
string for a schema or subschema, it's rendered and used in the hover
text instead of the `description` keyword.

The other major change in the schema is to replace the semantically
incorrect multi-type of `null` and `string` with a single type of
`string`. The [JSON schema documentation][01] states:

> It's important to remember that in JSON, null isn't equivalent to
> something being absent.

For JSON schemas, the `required` keyword indicates whether a property
is required. By convention, if a property isn't required and isn't
intended to be semantically `null`, it should be omitted from the JSON
representation of the object instance. Using `null` in a multi-type
should be reserved for when a `null` value carries specific semantics.

[01]: https://json-schema.org/understanding-json-schema/reference/null.html#null
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Aug 24, 2023
This change updates the `Microsoft/OSInfo` resource based on the work
for documenting it in MicrosoftDocs/PowerShell-Docs-DSC#181

This change:

- Minimally modifies the README for grammar and formatting.
- Adds docs strings to the types in the source code.
- Adds a canonical schema for the resource, and a YAML version of the
  schema for easier reading and maintaining.
- Updates the resource manifest to embed the canonical schema.

The canonical schema is generated from the YAML version using the
following command:

```powershell
$YamlPath = Resolve-Path -Path .\schemas\resources\Microsoft\OSInfo\v0.1.0\schema.yaml
| Select-Object -ExpandProperty Path
$JsonPath = $YamlPath -replace '\.yaml$', '.json'

$Schema       = Get-Content -Raw -Path $YamlPath | ConvertFrom-Yaml
$Schema.'$id' = $Schema.'$id' -replace '\.yaml$', '.json'

$Schema
| ConvertTo-Json -Depth 100
| Out-File -Encoding utf8 -Path $JsonPath -Force
```

The schema uses the first sentence from the documentation as the value
for the `description` keyword for each property, replacing backticks
with single quotes, as the `description` keyword doesn't reliably
render as Markdown for editors that support hover help for JSON
schemas. After every description string is the link to that property in
the documentation.

The `markdownDescription` is a non-standard keyword supported by the
JSON and YAML language servers in VS Code. When it's a non-empty string
for a schema or subschema, it's rendered and used in the hover text
instead of the `description` keyword.

The other major change in the schema is to replace the semantically
incorrect multi-type of `null` and `string` with a single type of
`string`. The [JSON schema documentation][01] states:

> It's important to remember that in JSON, null isn't equivalent to
> something being absent.

For JSON schemas, the `required` keyword indicates whether a property
is required. By convention, if a property isn't required and isn't
intended to be semantically `null`, it should be omitted from the JSON
representation of the object instance. Using `null` in a multi-type
should be reserved for when a `null` value carries specific semantics.

[01]: https://json-schema.org/understanding-json-schema/reference/null.html#null
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Aug 31, 2023
This change updates the `Microsoft/OSInfo` resource based on the work
for documenting it in MicrosoftDocs/PowerShell-Docs-DSC#181

This change:

- Minimally modifies the README for grammar and formatting.
- Adds docs strings to the types in the source code.
- Adds a canonical schema for the resource, and a YAML version of the
  schema for easier reading and maintaining.
- Updates the resource manifest to embed the canonical schema.

The canonical schema is generated from the YAML version using the
following command:

```powershell
$YamlPath = Resolve-Path -Path .\schemas\resources\Microsoft\OSInfo\v0.1.0\schema.yaml
| Select-Object -ExpandProperty Path
$JsonPath = $YamlPath -replace '\.yaml$', '.json'

$Schema       = Get-Content -Raw -Path $YamlPath | ConvertFrom-Yaml
$Schema.'$id' = $Schema.'$id' -replace '\.yaml$', '.json'

$Schema
| ConvertTo-Json -Depth 100
| Out-File -Encoding utf8 -Path $JsonPath -Force
```

The schema uses the first sentence from the documentation as the value
for the `description` keyword for each property, replacing backticks
with single quotes, as the `description` keyword doesn't reliably
render as Markdown for editors that support hover help for JSON
schemas. After every description string is the link to that property in
the documentation.

The `markdownDescription` is a non-standard keyword supported by the
JSON and YAML language servers in VS Code. When it's a non-empty string
for a schema or subschema, it's rendered and used in the hover text
instead of the `description` keyword.

The other major change in the schema is to replace the semantically
incorrect multi-type of `null` and `string` with a single type of
`string`. The [JSON schema documentation][01] states:

> It's important to remember that in JSON, null isn't equivalent to
> something being absent.

For JSON schemas, the `required` keyword indicates whether a property
is required. By convention, if a property isn't required and isn't
intended to be semantically `null`, it should be omitted from the JSON
representation of the object instance. Using `null` in a multi-type
should be reserved for when a `null` value carries specific semantics.

[01]: https://json-schema.org/understanding-json-schema/reference/null.html#null
@michaeltlombardi michaeltlombardi deleted the ab-118304/main/registry-osinfo-reference branch September 13, 2023 20:09
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.

2 participants