https://github.com/sake92/openapi4s-demo
https://github.com/sake92/openapi4s-demo
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sake92/openapi4s-demo
- Owner: sake92
- License: apache-2.0
- Created: 2024-12-26T14:59:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T02:43:34.000Z (over 1 year ago)
- Last Synced: 2025-03-20T03:36:27.369Z (over 1 year ago)
- Language: Shell
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openapi4s-demo
Petstore [spec](api/resources/openapi.json) is downloaded on 26.12.2024 from https://petstore3.swagger.io/api/v3/openapi.json
Here is a video demo: https://youtu.be/kf0vGrlKNb8
## Usage
```shell
# 1. update the openapi.json
# 2. (re)generate
./mill api.openApi4sGenerate
# 3. see what changed
git diff
# 4. fill in the details
./mill api.compile
# 5. git commit
```
By default, all endpoints will return 501 NotImplemented status.
You just need to fill in the details. :)
OpenApi4s will only overwrite definitions that it wrote originally (not the expressions though!).
Any class/method/val generated by OpenApi4s can be overwritten if you change it manually!
Other code (e.g. business logic in controller), *that you wrote* will not be touched. :)
## Swagger UI
Access it at http://localhost:8080/swagger
## CI check
There is a small chance that OpenApi4s overwrites your changes.
To prevent that, there is a [small CI script](./.github/workflows/ci.yml) that checks this.
It *forcefully regenerates the files*, and makes sure there is no `git diff` changes after that.
This way you can be sure that your changes are preserved correctly.