Advertisement
Advertisement

More Related Content

Advertisement

Learn Spring Boot With Bisky - Swagger

  1. Spring Boot for Beginners Swagger UI Example
  2. Youtube Video Playlist Link https://www.youtube.com/@CodeWithBisky
  3. What is Swagger? Swagger is an open source set of rules, specifications, and tools for developing RESTful APIs. ● It provides a framework for developers to create interactive API documentation. ● The documentation generated by Swagger is both machine-readable and human-readable. ● Swagger helps in describing and documenting the different endpoints, parameters, responses, and other details of an API. ● Developers can use Swagger to build APIs that are easier to understand and use by other developers. ● It simplifies the process of documenting and sharing API information, making it accessible to both humans and machines. ● The Swagger framework enables developers to design and develop APIs that conform to industry standards and best practices. ● By using Swagger, developers can ensure consistent and accurate documentation of their APIs, making it easier for others to integrate with and consume their services.
  4. Integration We are going to add the following dependency <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0-M4</version> </dependency> Add the following configuration to rh SpringBootApplication @SpringBootApplication(scanBasePackages = {"com.code.with.bisky.*","org.springdoc"}) Accessing swagger-UI http://localhost:8991/swagger-ui.html
  5. Document Rest Controller API’s We can document our API’s with the following annotations ● @Operation ● @ApiResponses ● @ApiResponse @Operation(summary = "Creates a new user") @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "Created user"), @ApiResponse(responseCode = "400", description = "Bad request"), @ApiResponse(responseCode = "500", description = "Server Error") })
  6. Code With Bisky Don’t forget to like, share, subscribe and click the notification bell so that you are notified whenever we upload a new video Salut Coders! https://www.youtube.com/@CodeWithBisky
Advertisement