-
Notifications
You must be signed in to change notification settings - Fork 244
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
Adds support for generating Mermaid diagrams from APIs #1113
Conversation
catch (Exception ex) | ||
{ | ||
#if DEBUG | ||
logger.LogCritical(ex, ex.Message); | ||
throw; // so debug tools go straight to the source of the exception when attached | ||
#else | ||
logger.LogCritical( ex.Message); | ||
return 1; | ||
#endif | ||
} |
Check notice
Code scanning / CodeQL
Generic catch clause
} | ||
} | ||
|
||
private static void WriteTreeDocument(string openapi, OpenApiDocument document, StreamWriter writer) |
Check notice
Code scanning / CodeQL
Generic catch clause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of comments on top of the ones already provided by codeql.
Also it seems you created your branch from master. I'd suggest rebasing from vnext for history sanity.
@baywet You tricked me with that .Order() method. It doesn't exist. At least my version of .NET doesn't know about it. I put the .OrderBy( o=>o) back. |
@darrelmiller ah right! it's an addition of .net 7, sorry about that, I'm in the future. |
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
OMG. I rebased successfully for the first time ever. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on the rebase, I hope you used the CLI :P
@baywet The git CLI, yes. I was lucky because there were no merge conflicts. |
Code coverage metric achieved. :-) /cc @MaggieKimani1 @baywet |
good job on the coverage. I encourage you to check the code smells to wrap this up (+ the comment I left) https://sonarcloud.io/project/issues?id=microsoft_OpenAPI.NET&pullRequest=1113&resolved=false&types=CODE_SMELL |
Kudos, SonarCloud Quality Gate passed! |
Added a show command to the hidi command line and also added a WriteMermaid function to the OpenApiUriTreeNode class.
Examples of the output are here https://github.com/darrelmiller/openapi-collection/tree/main/ApiDiagrams
The show command wraps the mermaid in a markdown file with a legend to explain the coloring of the nodes. Each node is styled with a color that maps to the set of HTTP methods that are supported. This mapping is defined by the MermaidColorScheme dictionary on OpenApiUriTreeNode. That dictionary can be customized to change the colors or add new combinations of HTTP methods.
GitHub markdown does not render the HTML legend that the show command emits. However, the VS code markdown preview does.
This closes #820