leaderboardsgg / leaderboard-backend

The backend for Leaderboards.gg. Also holds public-facing APIs.
https://info.leaderboards.gg
GNU General Public License v3.0
12 stars 16 forks source link

Automatically generate OpenApi spec file + CI check #139

Closed Dalet closed 1 year ago

Dalet commented 1 year ago

Changes summary

Look at the latest commit separately to see the actual changes I made. The PR diff says I changed everything in the csproj because I fixed the indentation in the first commit.

Motivation

Currently the frontend team has to run the server locally to access the file which is not ideal.

I explicitly want the file to be committed manually (and not by the CI) because the OpenApi spec changes should be manually reviewed (unintended breaking changes, unexpected object serialization...).

I named the file openapi.json because it is recommended here: https://swagger.io/specification/ ("Document Structure" section)

zysim commented 1 year ago

Ensure openapi.json is checked out with LF line endings via .gitattributes, because the tool always generates with LF.

This is done solely for the Github action, right, or is there any other reason for this enforcement?

Dalet commented 1 year ago

Ensure openapi.json is checked out with LF line endings via .gitattributes, because the tool always generates with LF.

This is done solely for the Github action, right, or is there any other reason for this enforcement?

On Windows the file may be checked out with CRLF line endings (depending on git config). Since the generation tool always outputs LF, git could say the file has changed even though only the line endings changed.

This is not required by the CI stuff, this is just QoL for developers.