This server-side application provides the Pet Store REST API according to the following OpenAPI Specification.
The code was created with the following options:
| Option | Value |
|---|---|
| Language | java 17 |
| Framework | SpringBoot 3.2.5 |
| Build tool | gradle |
The project includes:
Further sections of this readme provide instructions to set up and run this project locally or on the cloud platform.
| Path | Description |
|---|---|
| gradle.properties | Gradle scripts |
| gradle/wrapper/gradle-wrapper.jar | Gradle scripts |
| gradle/wrapper/gradle-wrapper.properties | Gradle scripts |
| gradlew | Gradle scripts |
| gradlew.bat | Gradle scripts |
| build.gradle | Main gradle build script defining plugins and dependencies used |
| gradle/scripts/openapi_generate.gradle | OpenApi plugin configuration |
| gradle/scripts/jib.gradle | Build docker image with jib |
At the build stage of the pipeline this task is run automatically by the build job, but you can also run it manually
Run gradlew build
When completed, the built JAR can be found in build/libs
Models and API classes are generated by OpenAPI Generator plugin.
OpenAPI Generator plugin provides a task that executes code generation. The task runs automatically when the build/test task is triggered. You can also run it separately.
Run gradlew openApiGenerate
The following sources will be generated in corresponding directories:
| Path | Description |
|---|---|
| build/generated-sources/src/main/java/de/openapi/petstore/api | API |
| build/generated-sources/src/main/java/de/openapi/petstore/model | Model |
A MongoDB is needed to run the application. It is expected to be available via mongodb://localhost:27017 in the local
environment. You can simulate this with an in-memory database if you run gradlew runMongoH2StandaloneApplication.
To start the application locally, execute the following task from your IDE or command line.
Run gradlew bootRun
The generated application exposes the API with default generated controllers. The default context root is "/".
The API could be browsed in the swagger-ui dashboard:
- localhost: http://localhost:8080/swagger-ui/index.html
- DEV environment: https://((your.ingress-host))/swagger-ui/index.html
For further reference, please consider the following sections: