-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Description of Issue
When a PowerShell Universal endpoint is configured with multiple HTTP methods on the same route and uses PowerShell parameter sets to separate GET and PUT, Swagger/OpenAPI renders the parameters incorrectly for the GET operation.
The main issue is that a parameter that is only mandatory in the PUT parameter set is still shown under GET and is marked as required.
A related symptom is that helper switches such as GET and PUT may also appear in Swagger when used as a workaround, but internal validation showed the primary issue persists even without those helper switches.
Direct runtime execution behaves correctly. The problem appears limited to Swagger/OpenAPI generation and Swagger UI / Swagger Execute.
List of steps, sample code, failing test or link to a project that reproduces the behavior:
- Create a multi-method endpoint with
GETandPUTon the same route. - Use parameter sets so that:
- one shared identifier parameter is mandatory for both
GETandPUT - one action-specific parameter is mandatory only for
PUT
- one shared identifier parameter is mandatory for both
- Open the generated Swagger/OpenAPI documentation.
- Review the
GEToperation.
Expected behavior:
GETshould only show the shared identifier parameter as required.- The PUT-only parameter should not appear under
GET.
Actual behavior:
GETshows the PUT-only parameter and marks it as required.- Runtime calls still behave correctly outside Swagger.
Sample code:
[CmdletBinding(DefaultParameterSetName = 'GET')]
param (
[Parameter(ParameterSetName = 'GET', Mandatory = $true)]
[Parameter(ParameterSetName = 'PUT', Mandatory = $true)]
[string]$ResourceId,
[Parameter(ParameterSetName = 'PUT', Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[ValidateSet("OptionA", "OptionB")]
[string]$ActionType
)
switch ($PSCmdlet.ParameterSetName) {
'GET' {
@{ Method = 'GET'; ResourceId = $ResourceId } | ConvertTo-Json
}
'PUT' {
@{ Method = 'PUT'; ResourceId = $ResourceId; ActionType = $ActionType } | ConvertTo-Json
}
}Additional reproduction notes:
Internal validation tested 3 variants:
- Multi-method endpoint with helper switches
GET/PUT - Multi-method endpoint without helper switches
- Separate
GETandPUTendpoints
Results:
- Variant 1: Swagger
GETshowed the shared parameter, the PUT-only parameter, and helper switches; the PUT-only parameter was marked required - Variant 2: Swagger
GETstill showed the shared parameter and the PUT-only parameter; the PUT-only parameter was marked required - Variant 3: Separate
GETendpoint only showed the shared parameter as expected
This suggests the issue is in OpenAPI parameter-set mapping for multi-method endpoints, not just the helper-switch workaround.
Version
2026.1.3 / 2026.1.4
Severity
Medium
Hosting Method
MSI (Windows Service)
Operating System
Windows
Database
SQLite
Licensed
Yes
Features
API Endpoints
OpenAPI / Swagger
Additional Environment data
Direct runtime execution via Invoke-RestMethod succeeded in all tested variants.
Issue appears isolated to Swagger/OpenAPI generation and Swagger UI / Swagger Execute.
Customer also confirmed the issue still persists after testing in 2026.1.4.
Screenshots/Animations
No response