nessie icon indicating copy to clipboard operation
nessie copied to clipboard

Supply additional information in NessieReferenceConflictException about the reference in conflict.

Open stuwyrough opened this issue 2 years ago • 1 comments

Description: We would like to provide more info to a user when they create a branch or a tag with a name that already exists. Currently we can only tell them that the reference exists, but not whether it is a branch or a tag. EX -- a tag with name 'tag' exists, and we try to create branch with name 'tag'. We would like to tell the user that there already exists a tag with name 'tag', not just a reference with name tag.

Requested Changes in public API:

  • Changes in REST API - Provide an additional property in NessieReferenceConflictException that will contain the Reference.ReferenceType that is in conflict.

stuwyrough avatar Jan 30 '23 14:01 stuwyrough

Propagating advanced properties through exceptions over REST API may be problematic in non-java language bindings and cause API divergence in those cases.

We already have an existing mechanism for returning extra error data for merge conflicts in main response payload:

https://github.com/projectnessie/nessie/blob/9dfce9d4171dcbf0e48e17c5512249d7fca87f5f/clients/client/src/main/java/org/projectnessie/client/api/MergeTransplantBuilder.java#L39

https://github.com/projectnessie/nessie/blob/9dfce9d4171dcbf0e48e17c5512249d7fca87f5f/model/src/main/java/org/projectnessie/model/MergeResponse.java#L40

@stuwyrough : Would a similar approach for reference creation (API v2) be acceptable in your use cases?

dimas-b avatar Feb 03 '23 15:02 dimas-b