I have a .NET Core project documented using Swashbuckle (Swashbuckle.AspNetCore.SwaggerGen 3.0.0 and Swashbuckle.AspNetCore.SwaggerUi 3.0.0). My aim's to add a custom tag right below the DIV with class title (i.e. below the service's name but above the endpoints).
When I investigate Swagger UI markup, I see there's a DIV with class swagger-ui and I'd like insert my stuff into it, so to speak. The setup I have today is a file called donkey.html which is being rendered when I access the URL of Swagger UI looking as follows.
...
<body>
<div id="swagger-ui"></div>
<div id="api_info"></div>
<!-- ... -->
<script src="./swagger-ui-bundle.js"></script>
<script src="./swagger-ui-standalone-preset.js"></script>
<script type="text/javascript">
(function () { ... })();
</script>
</body>
</html>
I've googled for a few hours now and read a lot about OpenAPI and YAML among other things. However, the impression I'm getting is that it requires a whole rebuild of the Swagger UI project and my ambition targets a much simpler task at the moment.
Is there a way to jack the DIV called api_info so it renders as a part of swagger_ui with out regenerating the whole Swagger UI project?
I tried to augment onto the base layout as shown here but that ended poorly and turned out to be a bit more complicated than what I'm aiming for. Perhaps it's the only feasible approach to create a module, in which case I'll consider it, but that's the last resource in this case.
See Question&Answers more detail:os