POC showing how to divide endpoint(s) among different Open-API screens

Overview

Multiple Open-API groups: Spring boot

POC showing how to divide endpoint(s) among different Open-API screens

Demo Link (Select definition from top right corner)


multiple-open-api-defintions-demo-screen-record.mov

Steps

  1. Put the below dependency in pom.xml
<dependency>
	<groupId>org.springdoc</groupId>
	<artifactId>springdoc-openapi-ui</artifactId>
	<version>1.5.10</version>
</dependency>
  1. Put the below mentioned property in the application.properties file
springdoc.api-docs.groups.enabled=true
  1. Divide the controller endpoint(s) of each group in a distinct base package
- com.behl.controller.nsfw
  - put endpoint(s) that belong in 'nsfw' group here
- com.behl.controller.sfw
  - put endpoint(s) that belong in 'sfw' group here
  1. Define Bean of type GroupedOpenApi for each group and specify the package to scan
@Bean
public GroupedOpenApi nsfwOpenApi() {
	String packagesToscan[] = { "com.behl.agares.controller.nsfw" };
	return GroupedOpenApi.builder().group("nsfw")
			.packagesToScan(packagesToscan).build();
}
  1. (Optional) To customize the Open-API defintion including info, contact, security etc implement OpenApiCustomiser interface and override customize() containing your custom configurations
@Configuration
public class NsfwOpenApiCustomizer implements OpenApiCustomiser {

	@Override
	public void customise(final OpenAPI openApi) {
		final var info = new Info().title("Not Safe For Work Joke API").version("1.0")
				.description("Endpoint(s) to expose to mature audience")
				.contact(new Contact().email("[email protected]").name("Hardik Singh Behl")
						.url("https://www.linkedin.com/in/hardiksinghbehl/"));
		openApi.info(info);
	}

}

Pass the class implementing OpenApiCustomizer in the .addOpenApiCustomiser(OpenApiCustomizer) method in the earlier created GroupedOpenApi Bean

@Bean
public GroupedOpenApi sfwOpenApi() {
	String packagesToscan[] = { "com.behl.agares.controller.sfw" };
	return GroupedOpenApi.builder().group("sfw").addOpenApiCustomiser(nsfwOpenApiCustomizer)
			.packagesToScan(packagesToscan).build();
}
  1. Access the swagger-ui at the below URI containing multiple configured definition/groups
http://server:port/swagger-ui.html
http://localhost:8080/swagger-ui.html
You might also like...

These samples explore the different options that Spring Boot developers have for using Javascript and CSS on the client (browser) side of their application.

These samples explore the different options that Spring Boot developers have for using Javascript and CSS on the client (browser) side of their application.

Table of Contents Getting Started Narrowing the Choices Create a New Application Webjars Show Me Some Javascript Normalizing Resource Paths Adding Tab

Jul 29, 2022

Rebuilding nand2tetris from scratch in different way - Group Project

nand2tetris Rebuilding nand2tetris from scratch in different way - Group Project License - GNU GPL v2.0 The contents of this file are subject to the G

Apr 2, 2022

It is a Basic Comment App for different users.

It is a Basic Comment App for different users.

Zoho-comments It is a Basic Comment App for different users. Technology Used : JAVA Swing, Mysql. Tools Used : Eclipse , WampServer. Mysql Table : sig

Feb 12, 2022

Pandora - allowing to control different agents (Windows & Linux machine) from server(s) and master

Pandora - allowing to control different agents (Windows & Linux machine) from server(s) and master

Pandora Pandora is now an open-source project allowing to control different agents (Windows & Linux machine) from server(s) and master. Features Auto-

Dec 22, 2022

Turismo Tierra Media: a system that stores the information of different attractions of Middle Earth amusement park

turismo-tierra-media is a system that stores the information of different attractions of Middle Earth amusement park. The system suggests visits based on the location of the visitors, and also generates itineraries based on the information on preferences available in the user's profile.

Feb 17, 2022

A blockchain system to manage monetary transactions between the different nodes of a decentralized network.

A blockchain system to manage monetary transactions between the different nodes of a decentralized network.

Blockchain under a clear vision A blockchain system to manage monetary transactions between the different nodes of a decentralized network. Authors @s

Jun 9, 2022

Create different patterns and designs using your favorite programming language for this project.

Create different patterns and designs using your favorite programming language for this project.

Patterns project for Hacktoberfest Create different patterns and designs using your favourite programming language weather it be a square pattern, sta

Oct 5, 2022

A command-line tool to generate different types of noise as images.

noisegen A command-line tool to generate different types of noise as images. Usage Run one of the releases, either the JAR using java -jar noisegen-0.

Jul 21, 2022

A mc server plugin for papermc.A different version of speed run.

弃坑状态 日后重置 HungerGamesSpeedRun 此乃一papermc之服务器插件。修改版速通 A mc server plugin for papermc.A different version of speed run. 编译/Compile 1.如编译其他插件般编译此插件 1.Jus

Feb 3, 2022
Owner
Java developer working extensively in spring boot and libraries relating to the java ecosystem.
null
A minimal WHIP implementation for the Raspberry Pi. It sends Mic and Camera to a WHIP endpoint

whipi A minimal WHIP implementation for the Raspberry Pi. It sends Camera Mic to a WHIP endpoint. Requires a Raspberry Pi with a PiCam and Java 11. It

|pipe| 12 Oct 27, 2022
Tool for providing an HTTP endpoint to retrieve predefined aggregations on metrics of an InfluxDB.

InfluxDB DWH Exporter This application provides an HTTP endpoint that can deliver metrics from an InfluxDB in an aggregated form when called. This can

Novatec Consulting GmbH 1 Jan 18, 2022
An example project showing how to enable tiered compilation on a Java AWS Lambda function.

AWS Lambda Tiered Compilation Sample Getting started Download or clone the repository. To install prerequisite software: Install AWS CDK Install Apach

AWS Samples 18 Dec 13, 2022
Log4J CVE-2021-44228 Minecraft PoC

CVE-2021-44228 in Minecraft Java 16 Paper server build #397 Minecraft 1.17.1 Exploitation In Java 16 only deserialization attacks work by default usin

myxl 5 Feb 15, 2022
LightAdmin - [PoC] Pluggable CRUD UI library for Java web applications

LightAdmin - [PoC] Pluggable CRUD UI library for Java web applications The primary goal of this PoC project is to speed up application development by

la-team 655 Dec 16, 2022
spring-cloud-function SpEL RCE, Vultarget & Poc

spring-cloud-function SpEL RCE Vultarget You can build it for youself. here is the source of the Vuln App Or you can use the release which built by cc

cckuailong 133 Nov 30, 2022
PoC for CVE-2021-31805 (Apache Struts2)

CVE-2021-31805 PoC for CVE-2021-31805 (Apache Struts2) CVE-2021-31805の解説記事で使用したアプリケーションです。 セットアップ $ docker-compose build $ docker-compose up -d 動作確認

null 4 May 21, 2022
Slueth(Zipkin) 를 통한 SQS Message Tracing POC(Proof of concept) 입니다.

Sleuth AWS SQS POC 해당 프로젝트는 Slueth(Zipkin) 를 통한 메시지 추적 POC(Proof of concept) 입니다. Rest API 를 통해 POST 요청을 받으면, 메시지를 발행/소비 합니다. 이 과정에서 유지되는 TraceId 를 확인

Hyunjin Jeong 10 Nov 29, 2022
log4j2 rce、poc

Apache Log4j 2 Apache log4j2 开源日志组件远程代码执行 攻击者通过构造恶意请求,触发服务器log4j 2 日志组件的远程代码执行漏洞。漏洞无需特殊配置,经验证,最新版的补丁可以防护此问题 官方最新补丁: log4j-2.15.0-rc2 紧急处置方案 2.10 or 以上

null 86 Dec 4, 2022
FactionRanking is a plugin that allows server administrators to put factions in competition in different rankings

Description FactionRanking is a plugin that allows server administrators to put factions in competition in different rankings (working for 1.7 and hig

nz 8 Dec 22, 2022