diff --git a/Justfile b/Justfile index 6ba562538fba..ce16e0a622b4 100644 --- a/Justfile +++ b/Justfile @@ -300,10 +300,13 @@ prepare-release version: # see --workspace flag https://doc.rust-lang.org/cargo/commands/cargo-update.html # used to update Cargo.lock after we've bumped versions in Cargo.toml @cargo update --workspace - @just generate-openapi + @just set-openapi-version {{ version }} @git add Cargo.toml Cargo.lock ui/desktop/package.json ui/desktop/package-lock.json ui/desktop/openapi.json @git commit --message "chore(release): release version {{ version }}" +set-openapi-version version: + @jq '.info.version |= "{{ version }}"' ui/desktop/openapi.json > ui/desktop/openapi.json.tmp && mv ui/desktop/openapi.json.tmp ui/desktop/openapi.json + # extract version from Cargo.toml get-tag-version: @uvx --from=toml-cli toml get --toml-path=Cargo.toml "workspace.package.version" diff --git a/crates/goose-server/src/bin/generate_schema.rs b/crates/goose-server/src/bin/generate_schema.rs index 8ddb867bef49..ec5bd33aad95 100644 --- a/crates/goose-server/src/bin/generate_schema.rs +++ b/crates/goose-server/src/bin/generate_schema.rs @@ -19,7 +19,7 @@ fn main() { fs::create_dir_all(parent).unwrap(); } - fs::write(&output_path, &schema).unwrap(); + fs::write(&output_path, format!("{schema}\n")).unwrap(); eprintln!( "Successfully generated OpenAPI schema at {}", output_path.canonicalize().unwrap().display() diff --git a/scripts/check-openapi-schema.sh b/scripts/check-openapi-schema.sh index cbf07ac83182..d45f733f256c 100755 --- a/scripts/check-openapi-schema.sh +++ b/scripts/check-openapi-schema.sh @@ -8,7 +8,7 @@ echo "🔍 Checking OpenAPI schema is up-to-date..." # Check if the generated schema differs from the committed version echo "🔍 Comparing generated schema with committed version..." -if ! git diff --exit-code ui/desktop/openapi.json ui/desktop/src/api/; then +if ! git diff --ignore-space-change --exit-code ui/desktop/openapi.json ui/desktop/src/api/; then echo "" echo "❌ OpenAPI schema is out of date!" echo ""