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

Initial stab at creating swagger for dotnet-monitor #3241

Merged
merged 12 commits into from
Jan 18, 2023

Conversation

samsp-msft
Copy link
Member

@samsp-msft samsp-msft commented Jan 7, 2023

Summary

Adds swagger UI to dotnet-monitor as the default endpoint. That helps by giving you documentation of the endpoint, and also the ability to use it.

image

Issues

  • The default runtime generation of the api info was causing issues, so I am using a static version done at build time - which probably makes more sense for this scenario anyway.
  • The swagger files are generated in a wwwroot folder as part of the build, and despite having an itemgroup for it, they are not copied to the output artifacts folder, which is necessary for the UI. If you manually copy them over, it works.
    • This uses the static files middleware to deliver the files. I don't know much about the deployment of dotnet-monitor and if static files is the right approach. It may be better to have a middleware that can deliver the files from embedded resources.
  • The files I am generating don't have the output of the xml comments in them - not sure why - that needs to be debugged
  • You are already generating an openapi.json file somehow - which is what the UI is keyed off of, and yours has the descriptions from the xml comments, so I am doing excess work not as well as you.
  • I think we can do more annotations on the properties to make using them easier, providing default values etc.
Release Notes Entry

Add Swagger UI to dotnet-monitor as the default endpoint. This will provide documentation of endpoints, and also the ability to use them.

@samsp-msft
Copy link
Member Author

Added screenshot
image

Sam Spencer and others added 2 commits January 10, 2023 15:02
File is now embedded in resources of app so that we don't need to have a wwwroot hanging around. Created a controller to deliver that file.
Added authentication info so you can paste a JWT token into the UI to be able to call in authenticated scenarios
src/Tools/dotnet-monitor/Startup.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-monitor/Startup.cs Outdated Show resolved Hide resolved
Sam Spencer and others added 4 commits January 10, 2023 15:35
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@samsp-msft samsp-msft marked this pull request as ready for review January 11, 2023 00:14
@samsp-msft samsp-msft requested a review from a team as a code owner January 11, 2023 00:14
wiktork
wiktork previously approved these changes Jan 17, 2023
…s/HttpApi/ApiClientExtensions.cs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@jander-msft jander-msft merged commit 1466452 into dotnet:main Jan 18, 2023
@schmittjoseph schmittjoseph added the update-release-notes Pull requests that should be mentioned in the release notes label Jan 18, 2023
@jander-msft
Copy link
Member

/backport to release/7.x

@github-actions
Copy link
Contributor

Started backporting to release/7.x: https://github.com/dotnet/dotnet-monitor/actions/runs/4001350056

github-actions bot added a commit that referenced this pull request Jan 24, 2023
Co-authored-by: Sam Spencer <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Justin Anderson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
update-release-notes Pull requests that should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants