Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
components: rustfmt

- name: Fetch merged OpenAPI spec
env:
Expand Down Expand Up @@ -91,6 +92,14 @@ jobs:
--http-user-agent "hotdata-rust/${PACKAGE_VERSION}" \
--skip-validate-spec

# The 7.22.0 generator emits compact, non-rustfmt output, which buries real
# spec changes under formatting churn in every regen diff. Format only the
# generated subtrees so the diff shows semantic changes; the hand-written
# ergonomic layer is left to its own formatting (and is ignore-protected
# from the generator anyway).
- name: Format generated code
run: find src/apis src/models -name '*.rs' -print0 | xargs -0 rustfmt --edition 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: --edition 2021 is hardcoded here while the edition is also declared in Cargo.toml (edition = "2021"). If the crate edition is ever bumped, this will silently drift and format the generated code under the old edition's rules. Not worth a cargo fmt (which would touch the hand-written layer you're deliberately excluding), but you could derive it from Cargo.toml to keep them in sync, e.g. --edition "$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="hotdata") | .edition')". (not blocking)


- name: Clean up fetched spec
run: rm -f openapi.yaml

Expand Down
Loading