Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

RSamaraFintechpath/FailProject

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description:

  • In this guide, we will demonstrate the process of integrating SwaggerUI with your SpringBoot Application.

  • The main objective of establishing this connection is to generate documentation for your project.
    By integrating SwaggerUI with your SpringBoot Application, you can easily create comprehensive documentation that describes your API endpoints, request/response models, and other relevant details. Also, we will describe annotations to be used that follow SAIB standards.

Steps to Activate SwaggerUI on SpringBoot Application:

Note that we'll use SpringFox to generate SwaggerUI

  1. Add Maven Dependencies in pom.xml file:
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.9.2</version>
</dependency>  

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.9.2</version>
</dependency>
  1. Create seperate package and name it "swagger-config", and create a class inside that package and name it "SwaggerConfig"

swagger config

  1. Inside SwaggerConfig class you should create dockets
  • Docket represent the endpoints that you want to show in SwaggerUI.

configclass

  • Notes:
    • documentationType should be SWAGGER_2 that represent the version.
    • basePackage represent the package that you want to read the endpoints from.
    • pathSelector represent the exact endpoints that you want to represent from this package.
  1. Add path matcher to application.properties "to enable the visual representation for swagger ui"

pathmatcher

In the previous section, we described how to activate swagger ui to your spring boot application

Swagger Annotation that we'll use to follow SAIB Standards:

a. @SwaggerDefinition: annotation at Swagger Configuration layer:

  • @SwaggerDefinition that represent MetaData.
    • MetaData represent the project information such as (Title, Description ...etc).

swagger def

b. @ApiResponses: At method layer inside controller:

  • This annotation represent possible responses generated by endpoints.

ApiResponseAnnotation

Note: You can find the responses you should documented in your api's for each http methods in shared wiki "Sub Specific Standards".

c. @ApiParam: At method layer inside controller:

  • This annotation represent variables that we provided to our endpoints such as (Path variable, Query Parameter).

ApiParam

d. @ApiOperation: At method layer inside controller:

  • That represent description for each endpoint that we create in our project "what exactly should do"

ApiOperation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.