Open scottslowe opened 9 months ago
The leading whitespace is missing from these examples in schema.json
as well, so transferring the issue to pulumi/pulumi-azure-native to correct it at the source.
Thanks for reporting this @scottslowe; we'll take a look.
It seems that we've managed to reduce the number of incorrectly formated examples, but quite a few remain.
It's possible to identify the affected resources by searching for a newline directly followed by pulumi.Run
- with no whitespace between e.g. using the regex \npulumi\.Run
.
Some examples are always misformatted and some examples are sometimes misformatted.
Here's a list of resources which at least sometimes contain mis-formatted Go examples:
appplatform/ContainerRegistry
appplatform/Job
azurestackhci/UpdateRun
datafactory/Dataset
dataprotection/BackupInstance
datareplication/Fabric
datareplication/Policy
datareplication/ProtectedItem
datareplication/ReplicationExtension
eventhub/AppicationGroup
machinelearning/WebService
machinelearningservices/Compute
machinelearningservices/FeaturesetVersion
machinelearningservices/Job
machinelearningservices/LabelingJob
media/Job
media/MediaGraph
migrate/WorkloadDeployment
migrate/WorkloadInstance
network/LoadBalancer
operationalinsights/MachineGroup
recoveryservices/ReplicationFabric
recoveryservices/ReplicaitonMigrationItem
recoveryservices/ReplicationProtectionCluster
recoveryservices/ReplicationProtectionContainerMapping
securityinsights/CustomizableConnectorDefinition
videoanalyzer/PipelineTopology
workloads/ACSSBackupConnection
workloads/SAPVirtualInstance
The cause of the missing formatting appears to be related to the code being invalid and therefore failing when we attempt to reformat it.
One example of this is azurestackhci/UpdateRun
. Ignoring whitespace, the diff is:
Steps: azurestackhci.StepArray{
- interface{}{
+ &azurestackhci.StepArgs{
Description: pulumi.String("Prepare for SSU update"),
When generated with interface{}{
it fails to reformat. When using &azurestackhci.StepArgs{
it works correctly.
What happened?
While browsing the API docs for the Azure Native provider, I noted that numerous examples were incorrectly formatted or were missing formatting. While this doesn't make it impossible to use the example for guidance, it does significantly raise the level of effort required. Based on what I have observed so far, this only seems to affect examples in Go, and not any other languages.
URLs of specific examples: https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/ (see the second example in Go) https://www.pulumi.com/registry/packages/azure-native/api-docs/compute/virtualmachine/ (see the first example in Go)
I strongly suspect there are more, but these are the ones I can for sure confirm.
I viewed these using Firefox, and have not checked any other browsers.
Example
https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/ (see the second example in Go) https://www.pulumi.com/registry/packages/azure-native/api-docs/compute/virtualmachine/ (see the first example in Go)
Output of
pulumi about
N/A
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).