Skip to content

publish --delete-unmatched fails on APIs with revisions #260

Description

Command that triggered the bug

apiops publish --delete-unmatched

Expected behavior

Description

When pruning an API that has multiple revisions, the delete set contains both the base
API (e.g. my-api) and its revision entries (e.g. my-api;rev=2). The CLI deletes the
individual revision(s) and then the base API. APIM rejects the base/current-revision
delete:

ERROR DELETE api/my-api: Async operation failed for apis/my-api:
[ValidationError] Cannot delete the current revision of an API.

Root cause

The delete phase treats API revisions as independent resources and issues a DELETE for
each, including one that resolves to the current revision. APIM does not allow deleting
the current revision of an API individually, the whole API must be deleted (which removes
all revisions), or all non-current revisions must be removed before the API itself.

Expected behavior

  • Deleting an API that has revisions should remove the entire API (and all revisions) in a
    single operation against the base API id, or
  • Non-current revisions should be deleted first and the current revision only via the
    whole-API delete, never as an individual current-revision delete.

Actual behavior

Actual behavior

  • Non-current revision delete (my-api;rev=2) succeeds.
  • Base/current-revision delete (my-api) fails with
    Cannot delete the current revision of an API, leaving the API partially deleted.

apiops CLI version

1.0.0

Environment details

VScode, Devcontainer

CI/CD environment

N/A (running locally)

Is this bug blocking you?

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

close:fixedFixed by a previous PR or releasetype:bugSomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions