Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swagger API documentation with SpringDoc OpenAPI 3 integration #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

faizakram
Copy link
Owner

This pull request introduces API documentation for the application using Swagger with SpringDoc OpenAPI 3 integration. It leverages the springdoc-openapi-starter-webmvc-api dependency to automatically generate and expose API documentation for all REST endpoints.

Key Features

  1. Swagger UI Integration:

    • Adds Swagger UI to the application, providing a user-friendly interface to interact with and test all available REST APIs.
    • Automatically generates API documentation based on the existing controllers, request mappings, and model definitions.
  2. Real-time API Documentation:

    • Documentation is dynamically generated and updated based on annotations and configurations within the codebase.
    • Supports standard OpenAPI 3 features like parameter descriptions, request/response schemas, and example values.
  3. Easy Access and Testing:

    • The Swagger UI is accessible via the default endpoint: /swagger-ui.html.
    • Provides a convenient way for developers, testers, and external partners to understand and test the available APIs.

How to Access Swagger UI

Once the application is running, you can access the Swagger UI for API documentation by navigating to:

How to Test

To verify the Swagger integration:

  1. Start the application.
  2. Open a web browser and go to http://localhost:8080/swagger-ui.html.
  3. Review the auto-generated documentation for all REST endpoints.
  4. Use the Swagger UI to test various endpoints by sending requests directly from the interface.

Added Dependency

To enable Swagger with SpringDoc OpenAPI 3, the following dependency has been added to pom.xml:

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
    <version>2.4.0</version>
</dependency>

faizorg and others added 3 commits March 24, 2024 21:59
@faizakram faizakram added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants