Keycloak integration in Swagger

Swagger-ui can integrate with keycloak using the implicit authentication mode. You can setup oauth2 on swagger-ui so that it will ask you to authenticate instead of giving swagger-ui the access token directly. 1st thing, your swagger need to reference a Security definition like: “securityDefinitions”: { “oauth2”: { “type”:”oauth2″, “authorizationUrl”:”http://172.17.0.2:8080/auth/realms/master/protocol/openid-connect/auth”, “flow”:”implicit”, “scopes”: { “openid”:”openid”, “profile”:”profile” } … Read more

What is Swagger, Swashbuckle and Swashbuckle UI

Swagger is a notation/rules to write documentation. But why is it called a framework(Like angular/MVC)? It is probably called a “framework” because its’ purpose is to offer a systematic way of notating the interface of any RESTful service under the OpenAPI Specification. This is a big deal to developers because the spec is overseen by … Read more

Spring Boot 3 springdoc-openapi-ui doesn’t work

According to the documentation: For spring-boot 3 support, make sure you use springdoc-openapi v2 https://springdoc.org/v2/ For the integration between spring-boot and swagger-ui, add the library to the list of your project dependencies (No additional configuration is needed) <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0</version> </dependency> This will automatically deploy swagger-ui to a spring-boot application: Documentation will be available … Read more

How do you turn off swagger-ui in production

Put your swagger configuration into separate configuration class and annotate it with @Profile annotation -> so that it will be scanned into Spring context only in certain profiles. Example: @Configuration @EnableSwagger2 @Profile(“dev”) public class SwaggerConfig { // your swagger configuration } You can than define profile your Spring Boot app is operating in via command … Read more

Is it possible to add Authentication to access to NestJS’ Swagger Explorer

Securing access to your Swagger with HTTP Basic Auth using NestJS with Express First run npm i express-basic-auth then add the following to your main.{ts,js}: // add import import * as basicAuth from ‘express-basic-auth’; // … // Sometime after NestFactory add this to add HTTP Basic Auth app.use( [‘/docs’, ‘/docs-json’], basicAuth({ challenge: true, users: { … Read more

Why there are no themes for swagger-ui? [closed]

A late answer, albeit a good one. This is pretty awesome! A slick implementation, and he has customized many things that are easy to tweak yet again for your needs: https://github.com/jensoleg/swagger-ui. Credits go to this google group: https://groups.google.com/forum/#!topic/swagger-swaggersocket/oeMyayrvKRI. Strange that this has not been posted here yet. For an action demo, please check out this … Read more

How to add method description in Swagger UI in WebAPI Application

This is well documented in the project: https://github.com/domaindrivendev/Swashbuckle.AspNetCore#include-descriptions-from-xml-comments Include Descriptions from XML Comments To enhance the generated docs with human-friendly descriptions, you can annotate controller actions and models with Xml Comments and configure Swashbuckle to incorporate those comments into the outputted Swagger JSON: 1 – Open the Properties dialog for your project, click the “Build” … Read more