/openapi-example-toys-autogen

Example project with OpenAPI Contract First approach

Primary LanguageKotlinApache License 2.0Apache-2.0

OpenAPI Contract First Example Project

This is a project containing an OpenAPI specification according to which API classes are automatically generated during each compilation to help you create your own Rest service simpler. It demonstrates Contract First approach.

Installation

Check Gradle is installed and configured.

Clone the source locally:

$ git clone https://github.com/MorkovkAs/openapi-example-toys-autogen/

Build and run project:

$ cd openapi-example-toys-autogen/
$ ./gradlew build bootRun

Go to localhost page to see Swagger UI with Toys shop OpenAPI specification. Methods createToy, getToyById and deleteToyById have custom realizations. Others haven't. So http code 501 (NOT_IMPLEMENTED) will return.

Details

OpenAPI specification is located here.

Generated classes by OpenAPI specification will be located after compilation in build/generated/openapi/src.

To use generated code you should create your custom controller which implements a generated one. See ToysController class.

Thanks!

Any questions or problems give me a shout on email avklimakov@gmail.com

License

Copyright 2023 Anton Klimakov
Licensed under the Apache License, Version 2.0