Skip to content

Provides a REST API for the OpenAPI pet store based on Spring-Boot

License

Notifications You must be signed in to change notification settings

BjoernKarma/openapi-petstore

Repository files navigation

openapi-petstore

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.

Build scripts & configuration

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

Build the application

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

OpenAPI based code generation

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

Run the application locally

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

Endpoints

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:

Reference Documentation

For further reference, please consider the following sections:

About

Provides a REST API for the OpenAPI pet store based on Spring-Boot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •