Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples to swagger #4184

Open
Omzig opened this issue Dec 31, 2024 · 1 comment
Open

Add examples to swagger #4184

Omzig opened this issue Dec 31, 2024 · 1 comment
Labels
enhancement New feature or request PowerShell Universal Issue relates to PowerShell Universal.

Comments

@Omzig
Copy link
Collaborator

Omzig commented Dec 31, 2024

Summary of the new feature / enhancement

as a dev i want to be able to use the .EXAMPLE and have it show up in swagger.

i don't know if this is easy or not, i would hope it is easy

Proposed technical implementation details (optional)

https://docs.powershelluniversal.com/api/openapi
https://swagger.io/docs/specification/v3_0/adding-examples/#:~:text=You%20can%20add%20examples%20to,your%20API%20in%20some%20way.

i think this is the section we are interested, but they do not have any examples of what it looks like after it is rendered.

text/html:
    schema:
      type: string
    examples:
      html:
        summary: A list containing two items
        value: "<html><body><ul><li>item 1</li><li>item 2</li></ul></body></html>"

The end result should let me put in something like this and have it displayed in swagger nicely:

.EXAMPLE
$body = [PSCustomObject]@{
    customerId = '1131'
    providerName = 'Bob'
    environment = "PROD"
} | convertto-json

Invoke-RestMethod https://dev.domain.com/bot/jh/statuspage/api/v1/incidents/resolve -Method POST -Body $body
@Omzig Omzig added enhancement New feature or request PowerShell Universal Issue relates to PowerShell Universal. labels Dec 31, 2024
@Omzig
Copy link
Collaborator Author

Omzig commented Dec 31, 2024

Maybe it already does it but i am using it the wrong way...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PowerShell Universal Issue relates to PowerShell Universal.
Projects
None yet
Development

No branches or pull requests

1 participant