{"id":15597552,"url":"https://github.com/cdimascio/kotlin-openapi-spring-functional-template","last_synced_at":"2025-05-10T23:04:21.378Z","repository":{"id":83296687,"uuid":"112667402","full_name":"cdimascio/kotlin-openapi-spring-functional-template","owner":"cdimascio","description":"🍃 Kotlin Spring 5 Webflux functional application with api request validation and interactive api doc","archived":false,"fork":false,"pushed_at":"2020-04-21T02:59:09.000Z","size":4359,"stargazers_count":183,"open_issues_count":1,"forks_count":50,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-10T23:04:15.848Z","etag":null,"topics":["functional","hacktoberfest","kotlin","kotlin-spring-webflux","rest","spring","swagger","template","validation","webflux"],"latest_commit_sha":null,"homepage":"https://dzone.com/articles/build-rest-apis-with-kotlin-spring-5-webflux-and-p","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdimascio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-30T22:22:32.000Z","updated_at":"2025-03-13T10:24:01.000Z","dependencies_parsed_at":"2023-07-10T05:46:58.023Z","dependency_job_id":null,"html_url":"https://github.com/cdimascio/kotlin-openapi-spring-functional-template","commit_stats":{"total_commits":115,"total_committers":7,"mean_commits":"16.428571428571427","dds":0.3913043478260869,"last_synced_commit":"5b150c6aa74687779510cb0a0ac19c79eaa34cee"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fkotlin-openapi-spring-functional-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fkotlin-openapi-spring-functional-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fkotlin-openapi-spring-functional-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdimascio%2Fkotlin-openapi-spring-functional-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdimascio","download_url":"https://codeload.github.com/cdimascio/kotlin-openapi-spring-functional-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492710,"owners_count":21916972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional","hacktoberfest","kotlin","kotlin-spring-webflux","rest","spring","swagger","template","validation","webflux"],"created_at":"2024-10-03T01:22:24.106Z","updated_at":"2025-05-10T23:04:21.357Z","avatar_url":"https://github.com/cdimascio.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/m97tA5c"],"categories":[],"sub_categories":[],"readme":"# kotlin-swagger-spring-functional\n\n![](https://travis-ci.org/cdimascio/kotlin-openapi-spring-functional-template.svg?branch=master)![](https://img.shields.io/badge/license-Apache%202.0-blue.svg)\n\nA project template for *Kotlin Spring WebFlux*. The template features automatic request validation and interactive API documentation using an *OpenApi 3.0* or *Swagger 2.0* specification. The template provides 12-factor compliant environment based config and integrated in linting. \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/cdimascio/kotlin-swagger-spring-functional-template/master/assets/logo.png\" /\u003e\n\u003c/p\u003e\n\n### What's included?\n* Automatic request validation via [openapi-spring-webflux-validator](https://github.com/cdimascio/openapi-spring-webflux-validator)\n* Custom error responses via [openapi-spring-webflux-validator](https://github.com/cdimascio/openapi-spring-webflux-validator)\n* Environment based config via [java-dotenv](https://github.com/cdimascio/java-dotenv)\n* Interactive API documentation via [Swagger UI](https://swagger.io/swagger-ui/)\n* Automatic linting via [ktlint](ktlint.github.io)\n\nRequest validation and interactive documentation are based on an OpenApi 3.0 or Swagger v2 API specification. The specification is located at `main/resources/static/api.yaml`.\n\n## Install\n\nClone this repo\n\n## Build\n\n```shell\n./gradlew build\n```\n\n## Run\n\n```shell\n./gradlew run\n```\n\n\n## Lint\n\n```shell\n## show lint errors\n./gradlew lintKotlin\n\n## Attempt to auto fix lint errors\n./gradlew formatKotlin\n```\n\n\n## Test\n\n```shell\n./gradlew test\n```\n\n## Dist\n\n```shell\n./gradlew clean distZip\n```\n\nOutput artifact located at `build/distributions`\n\nor unpacked\n\n```shell\n./gradlew clean distZip unzip\n```\n\nOutput artifact located at `build/unpacked/dist`\n\n## Run the standalone dist\n\nCreate an unpacked dist. See the [Dist](#dist) section above. Then run it\n\n```shell\ncp build/unpacked/dist $HOME/kotlin-swagger-spring-functional-1.0.0/bin/kotlin-swagger-spring-functional\n\n```\n\n## Try It!\n\n[Run](#run) the app or run the [standalone dist](#run-the-standalone-dist), then:\n\n```xml\ncurl http://localhost:8080/api/users\n```\n\n### Try the example endpoints (with swagger validation)\n\nPOST to `/users` with a *valid* request body\n\n```shell\ncurl -X POST http://localhost:8080/api/users -H \"Content-Type: application/json\" -d '{ \"firstname\": \"carmine\", \"lastname\": \"dimascio\" }'    \n```\n\nresult\n\n```json\n{\n  \"firstname\":\"carmine\",\n  \"lastname\":\"dimascio\"\n}\n```\n\nPOST to `/users` with an *invalid* request body i.e. we leave off the required field `lastname`\n\n```shell\ncurl -X POST http://localhost:8080/api/users -H \"Content-Type: application/json\" -d '{ \"firstname\": \"carmine\" }'\n```\n\nresult\n\n```json\n{\n  \"errors\":[{\n    \"code\":\"bad_request\",\n    \"message\":\"Object has missing required properties ([\\\"lastname\\\"])\"}\n]}\n```\n\n### Try the Interactive API documentation\n \nNavigate to [http://localhost:8080](http://localhost:8080)\n\n![](https://github.com/cdimascio/kotlin-swagger-spring-functional-template/blob/master/assets/swagger1.png?raw=true)\n\n![](https://github.com/cdimascio/kotlin-swagger-spring-functional-template/blob/master/assets/swagger2.png?raw=true)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/katielevy1\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/8975181?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKatie Levy\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/cdimascio/kotlin-openapi-spring-functional-template/commits?author=katielevy1\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://about.me/naxa\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/3858548?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePaul\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/cdimascio/kotlin-openapi-spring-functional-template/commits?author=naXa777\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://ibragimov.by/\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/493656?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIbragimov Ruslan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/cdimascio/kotlin-openapi-spring-functional-template/commits?author=IRus\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/ChristofBuechi\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/2494089?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eChristof\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/cdimascio/kotlin-openapi-spring-functional-template/commits?author=ChristofBuechi\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n \n## License\n\n[Apache 2](LICENSE)\n\n\u003ca href=\"https://www.buymeacoffee.com/m97tA5c\" target=\"_blank\"\u003e\u003cimg src=\"https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdimascio%2Fkotlin-openapi-spring-functional-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdimascio%2Fkotlin-openapi-spring-functional-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdimascio%2Fkotlin-openapi-spring-functional-template/lists"}