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.
- Api First Design
- OpenAPI 3.0
- OpenAPI Generator
- Swagger UI
- Grouped APIs in SwaggerUI
- Java 11
- Check Todo Service OpenAPI specification. Open src/main/resources/api.yml
- Generate Spring controllers and models from the specification using Gradle plugin
./gradlew openApiGenerate
- Investigate generated models and controllers interfaces under
build/generated/sources/src/main/java
directory - Check TodoController implementation
- Add new endpoint or model to the service
- Update OpenAPI spec in api.yml
- Generate the new models or controllers by running again
./gradlew openApiGenerate
- Implement any new features
- Start Todo Service
./gradlew bootRun
- Open Swagger UI page and play with API 😉
For further reference, please consider the following sections:
Distributed under the MIT License. See LICENSE
for more information.