/spring-api-first-design-poc

This repository demonstrates an Api First Design approach of building simple Spring Boot Todo Service.

Primary LanguageJavaMIT LicenseMIT

Api First Design - Spring Boot demo

This repository demonstrates an api first approach of building simple Todo Service.

Contract first means that we're developing a specification before we begin implementing our service.

Features

  • Api First Design
  • OpenAPI 3.0
  • OpenAPI Generator
  • Swagger UI
  • Grouped APIs in SwaggerUI

Getting Started

Prerequisites:

  • Java 11

Usage:

  1. Check Todo Service OpenAPI specification. Open src/main/resources/api.yml
  2. Generate Spring controllers and models from the specification using Gradle plugin
    ./gradlew openApiGenerate
  3. Investigate generated models and controllers interfaces under build/generated/sources/src/main/java directory
  4. Check TodoController implementation
  5. Add new endpoint or model to the service
    1. Update OpenAPI spec in api.yml
    2. Generate the new models or controllers by running again./gradlew openApiGenerate
    3. Implement any new features
  6. Start Todo Service
    ./gradlew bootRun
  7. Open Swagger UI page and play with API 😉 grouped-api.png

Useful tools

References

For further reference, please consider the following sections:

License

Distributed under the MIT License. See LICENSE for more information.