You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to create document for an ARM template with user defined typed outputs and resource deployed, error Invoke-PSDocument: Object reference not set to an instance of an object. is triggered
#355
Open
GABRIELNGBTUC opened this issue
Jun 10, 2024
· 1 comment
We have some bicep/ARM templates that use outputs with a user defined type as the output type.
When trying to create documentation on the compiled ARM file using PSDocs, the command fails with the error Invoke-PSDocument: Object reference not set to an instance of an object..
This only happens if the template both:
Have an output with a user defined type as the type
A resource/module is also deployed in the same file
If I either replace the user defined type with object or remove all the resources/modules from the template, PSDocs successfully run
To reproduce
Have a bicep file with the following content:
typetest = {
str: string
}
paramtexttestresourceres'Microsoft.Compute/virtualMachines@2024-03-01'= {
name: 'myVM'location: ''
}
// si custom type + resource => instance of objectoutputouttest = {str: 'test'}
Compile that file with the bicep cli and run the following command
If you either replace the output line with output out object = {str: 'test'} or command the res resource, no error is triggered
Expected behaviour
The command succeed in creating the documentation.
Error output
Module in use and version:
Module: PSDocs.Azure
Version: 0.3.0
Captured output from $PSVersionTable:
VERBOSE: [Invoke-PSDocument]::BEGIN
VERBOSE: [New-PSDocumentOption] BEGIN::
VERBOSE: Attempting to read: D:\Users\GNGANDUB\OneDrive - TUC RAIL\Documents\test\test-json\psdoc
VERBOSE: [New-PSDocumentOption] END::
VERBOSE: [PSDocs][D] -- Scanning for source files in module: PSDocs.Azure
Invoke-PSDocument: Object reference not set to an instance of an object.
VERBOSE: [Invoke-PSDocument]::END
Additional context
The text was updated successfully, but these errors were encountered:
The issue is that there is no type property in the output when using user defined types.
You will see something like this in the JSON output when a bicep build is done:
"out": {
"$ref": "#/definitions/test",
...
}
I've tested it by changing $ref to type and then it will work again. If this is fixed there should also be support for rendering the definitions from the module in the output.
Description of the issue
We have some bicep/ARM templates that use outputs with a user defined type as the output type.
When trying to create documentation on the compiled ARM file using PSDocs, the command fails with the error
Invoke-PSDocument: Object reference not set to an instance of an object.
.This only happens if the template both:
If I either replace the user defined type with
object
or remove all the resources/modules from the template, PSDocs successfully runTo reproduce
Have a bicep file with the following content:
Compile that file with the bicep cli and run the following command
The command will fail.
If you either replace the output line with
output out object = {str: 'test'}
or command theres
resource, no error is triggeredExpected behaviour
The command succeed in creating the documentation.
Error output
Module in use and version:
Captured output from
$PSVersionTable
:Additional context
The text was updated successfully, but these errors were encountered: