Spring 5 MVC template with Kotlin and OpenAPI 3.0. (Also Supports Swagger 2.0)
Features automatic request/response validation and interactive API doc
Features:
- Automatic request and response validation via atlassian OpenApi 3.0
- Automatic documentation generation via Swagger UI
- 12 factor compliant configuration via java-dotenv
- Automatic code formatting and linting via ktlint
- Fully operational sample REST API
- API integration tests with Unirest REST client
- Simple HTTP errors via japi-errors
- Dockerfile
- Clone this repo
- copy
.env.template
tosrc/main/resources/.env
./gradlew build
./gradlew lintKotlin # see lint errors
./gradlew formatKotlin # attempt to automatically fix lint errors
./gradlew bootRun
./gradlew test
./gradlew jar
# Run the dist
java -jar ./build/libs/example-service-1.0.0.jar
Navigate to http://localhost:8080/api_explorer/index.html
curl -X POST "http://localhost:8080/users" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"me\":\"carmine\"}"
{
"error": " Object instance has properties which are not allowed by the schema: [\"me\"]",
"code": 400
}
Apache 2.0