# updateAttribute

## Overview

Updates an attribute definition's name and manages its full value lifecycle. Accepts an optional values array representing the desired state; the resolver computes a diff to create, update, and delete values as needed.

## Modules Commands Used

- `product-management.UpdateProductAttribute` — updates the attribute name
- `product-management.DeleteProductAttributeValue` — deletes values absent from the desired list
- `product-management.UpdateProductAttributeValue` — updates labels of existing values
- `product-management.CreateProductAttributeValue` — creates new values (entries without an ID)

## Exception Handling

| Error Code | Source | Description |
| --- | --- | --- |
| ATTRIBUTE_NOT_FOUND | UpdateProductAttribute | No attribute exists with the given ID |
| MISSING_REQUIRED_FIELD | UpdateProductAttribute | A required field was provided as empty |
| VALUE_NOT_FOUND | DeleteProductAttributeValue / UpdateProductAttributeValue | The specified value does not exist |
| VALUE_IN_USE | DeleteProductAttributeValue | The value is assigned to one or more products and cannot be deleted |
| DUPLICATE_VALUE | UpdateProductAttributeValue / CreateProductAttributeValue | A value with the given label already exists under this attribute |
| INVALID_LABEL | UpdateProductAttributeValue / CreateProductAttributeValue | The provided label is empty or contains invalid characters |
