Swagger Docs - Schemas Defined in Other Documentations Are Shown

Product: PowerShell Universal
Version: 4.1.8

When defining multiple documentation groups with New-PSUEndpointDocumentation, all schemas from all documentations are shown on the swagger page for each individual documentation group.

Steps to reproduce:

  1. Define 2 roles; Administrator and ContosoVendorAPI.
  2. Define 2 documentations (user and group) with New-PSUEndpointDocumentation and define a different class using “[Documentation()]; class …” for each. Restrict the “user” documentation so only “Administrator” can see and use it.
  3. Define 2 endpoints, user and group. Use the .OUTPUTS to specify the documentation classes for each. Restrict the “user” endpoint so only the first role can see and use it. Specify the tag and documentation for each.
  4. Restart the PowerShell Unversal service. This may not be strictly required, but I tend to do this when modifying files those are used by Swagger to ensure they are updated.
  5. Under a user with only the ContosoVendorAPI role visit the Swagger page for the “group” documentation; https://myserver.com/swagger/index.html?urls.primaryName=Group
  6. Check under “Schemas” on this page. The documentation class (schema) for the “user” endpoint will be shown.

I’ve posted the source code for reproducing this here: sean-sauve/PUDSwaggerDemo (github.com)

Created an issue here: Swagger Docs - Schemas Defined in Other Documentations Are Shown · Issue #2830 · ironmansoftware/issues (github.com)