API Documentation Body Doc

Product: PowerShell Universal
Version: 4.1.x

How do i document the Post Body json? I cannot find any documentation on this:

image

I just checked and the documentation is outdated. You should be able to add classes to the documentation file like this.

[Documentation()]
class MyReturnType {
    [string]$Value
}

Then you would set it as the input type.

New-PSUEndpoint -Url "/documented" -Method @('GET') -Endpoint {
<# 
.SYNOPSIS
This is an endpoint
    
.DESCRIPTION
This is a description

.PARAMETER Id
This is an ID.

.PARAMETER AnotherOne
This is AnotherOne

.OUTPUTS
    200:
        Description: This is an output value. 
        Content:
            application/json: MyReturnType

    400:
        Description: Invalid input
.INPUTS 
    Required: false
    Description: This is an input value.
    Content: 
        application/json: MyReturnType

#>
param($Id, $AnotherOne)
} -Authentication

This is what I’m referring to.

.INPUTS 
    Required: false
    Description: This is an input value.
    Content: 
        application/json: MyReturnType

I’ll add something to my todo list to improve this example.

1 Like