mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-24 09:58:17 +03:00
c454b1b488
* [chore] Bump tooling versions, bump go -> v1.23.0 * undo silly change * sign * bump go version in go.mod * allow overflow in imaging * goreleaser deprecation notices * bump versions * undo accidental rebase change * update container versions to just use latest major version * update swagger to our release with go1.23 fix * update goreleaser to use our vendored swagger version --------- Co-authored-by: kim <grufwub@gmail.com>
30 lines
1,016 B
Bash
Executable file
30 lines
1,016 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# Test that the Swagger spec is up to date and valid.
|
|
|
|
set -eu
|
|
|
|
swagger_cmd() {
|
|
go run ./vendor/github.com/go-swagger/go-swagger/cmd/swagger "$@"
|
|
}
|
|
swagger_spec='docs/api/swagger.yaml'
|
|
|
|
# Temporary directory for the regenerated Swagger spec.
|
|
temp_dir=$(mktemp -d)
|
|
# Can't use mktemp directly because we need to control the file extension.
|
|
regenerated_swagger_spec="${temp_dir}/swagger.yaml"
|
|
cleanup() {
|
|
rm -rf "${temp_dir}"
|
|
}
|
|
trap cleanup INT TERM EXIT
|
|
|
|
# Regenerate the Swagger spec and compare it to the working copy.
|
|
swagger_cmd generate spec --scan-models --exclude-deps --output "${regenerated_swagger_spec}"
|
|
if ! diff -u "${swagger_spec}" "${regenerated_swagger_spec}" > /dev/null; then
|
|
echo "${swagger_spec} is out of date. Please run the following command to update it:" >&2
|
|
echo " go run github.com/go-swagger/go-swagger/cmd/swagger generate spec --scan-models --exclude-deps --output ${swagger_spec}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Validate the Swagger spec.
|
|
swagger_cmd validate "${swagger_spec}"
|