diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d9ba5b..1185514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,16 @@ ## Unreleased - ReleaseDate +### Fixed + +- Previously, a `.json.gitstub` file whose filename hash didn't match its resolved contents (e.g. leftover from a mismerge) crashed `generate` and `check`. These files are now detected and cleaned up like other stale files. + ### Changed - Consistently use "OpenAPI document" everywhere instead of "OpenAPI spec". A number of type names have been changed to use this terminology. - `VersionedApiDocFileName::path` now always returns paths with a forward slash, including on Windows, matching the `Display` implementation. +- Unparseable local files (e.g. files with merge conflict markers) are now reported inline, within the problem whose fix handles them. The message also includes more information about why the file couldn't be parsed. Previously, the reason appeared only in a separate load-time warning (this warning has been removed). +- A lockstep document that exists but can't be parsed is now reported as stale rather than missing. ## [0.7.2] - 2026-05-20 diff --git a/crates/dropshot-api-manager/src/doc_files_generic.rs b/crates/dropshot-api-manager/src/doc_files_generic.rs index 717939d..8dba59d 100644 --- a/crates/dropshot-api-manager/src/doc_files_generic.rs +++ b/crates/dropshot-api-manager/src/doc_files_generic.rs @@ -705,8 +705,7 @@ impl<'a, T: ApiLoad + AsRawFiles> ApiDocFilesBuilder<'a, T> { /// Record a file as unparseable without attempting to parse it. /// /// This is used for files that are known to be invalid before attempting - /// JSON parsing (e.g., Git stubs with invalid format). The `reason` - /// error is recorded as a warning. + /// JSON parsing (e.g., Git stubs with invalid format). /// /// For contexts where unparseable files are allowed (local files), this /// tracks the file so it can be cleaned up during generate. For other @@ -736,12 +735,7 @@ impl<'a, T: ApiLoad + AsRawFiles> ApiDocFilesBuilder<'a, T> { match T::make_unparseable(file_name.clone(), contents, reason) { Some(unparseable) => { // For local files, track the unparseable file so it can be - // cleaned up during generate. Record a warning so the user - // knows about it. - self.load_warning(anyhow!( - "skipping unparseable file {path:?}: {rendered}" - )); - + // cleaned up during generate. let version = match file_name.version() { Some(version) => version.clone(), None => { diff --git a/crates/integration-tests/tests/output/integration/lockstep_unparseable.txt b/crates/integration-tests/tests/output/integration/lockstep_unparseable.txt index 2ebd5bc..0f13e75 100644 --- a/crates/integration-tests/tests/output/integration/lockstep_unparseable.txt +++ b/crates/integration-tests/tests/output/integration/lockstep_unparseable.txt @@ -1,7 +1,6 @@ ------- Generating OpenAPI documents from API definitions ... Loading local OpenAPI documents from "" ... - Warning skipping unparseable file "health.json": parsing as JSON: expected value at line 1 column 1 Loading blessed OpenAPI documents from VCS revision "main" path "documents" ------- Checking 1 OpenAPI document... diff --git a/crates/integration-tests/tests/output/integration/non_canonical_git_stub.txt b/crates/integration-tests/tests/output/integration/non_canonical_git_stub.txt index f45211f..c587805 100644 --- a/crates/integration-tests/tests/output/integration/non_canonical_git_stub.txt +++ b/crates/integration-tests/tests/output/integration/non_canonical_git_stub.txt @@ -1,7 +1,6 @@ ------- Generating OpenAPI documents from API definitions ... Loading local OpenAPI documents from "" ... - Warning skipping unparseable file "versioned-health/versioned-health-1.0.0-da85d6.json.gitstub": needs to be rewritten to canonical Git stub format with forward slashes and a trailing newline Loading blessed OpenAPI documents from VCS revision "main" path "documents" ------- Checking 3 OpenAPI documents... diff --git a/crates/integration-tests/tests/output/integration/orphaned_unparseable_doc.txt b/crates/integration-tests/tests/output/integration/orphaned_unparseable_doc.txt index 984542a..73f73e5 100644 --- a/crates/integration-tests/tests/output/integration/orphaned_unparseable_doc.txt +++ b/crates/integration-tests/tests/output/integration/orphaned_unparseable_doc.txt @@ -1,7 +1,6 @@ ------- Generating OpenAPI documents from API definitions ... Loading local OpenAPI documents from "" ... - Warning skipping unparseable file "versioned-health/versioned-health-3.0.0-05def5.json": parsing as JSON: expected value at line 1 column 1 Loading blessed OpenAPI documents from VCS revision "main" path "documents" ------- Checking 2 OpenAPI documents... diff --git a/crates/integration-tests/tests/output/integration/stale_hash_git_stub.txt b/crates/integration-tests/tests/output/integration/stale_hash_git_stub.txt index ee9c8bf..ff18fb9 100644 --- a/crates/integration-tests/tests/output/integration/stale_hash_git_stub.txt +++ b/crates/integration-tests/tests/output/integration/stale_hash_git_stub.txt @@ -1,7 +1,6 @@ ------- Generating OpenAPI documents from API definitions ... Loading local OpenAPI documents from "" ... - Warning skipping unparseable file "versioned-health/versioned-health-2.0.0-ffffff.json.gitstub": resolved contents have hash "511899", but file name has different hash "ffffff" Loading blessed OpenAPI documents from VCS revision "main" path "documents" ------- Checking 3 OpenAPI documents...