Skip to content

Add Deliverable: 400 from Pydantic — delivery_method_id sent as UUID, expected str #334

@stefanko-ch

Description

@stefanko-ch

Bug

Adding a Deliverable to a Data Product fails with 400 Failed to add deliverable whenever the Delivery Method dropdown is set to any value.

Steps to reproduce

  1. Settings → Reference Data → Delivery Methods → add at least one method (e.g. Table Access)
  2. Create a Data Product (e.g. Customer 360)
  3. On the product detail view, click + Add Deliverable
  4. Fill the dialog with at least Name, Version, and any Delivery Method from the dropdown
  5. Click Add Deliverable

Expected

Deliverable saves; the product detail view lists it under Deliverables.

Actual

Red toast: Failed to add deliverable (400). Network response:

1 validation error for DataProduct
output_ports.0.delivery_method_id
  Input should be a valid string [type=string_type, input_value=UUID('17545eff-3fa0-42e8-863a-be3947adbb41'), input_type=UUID]

Cause

delivery_method_id reaches the Pydantic model as a Python UUID instance. The model in src/backend/src/models/data_products.py declares:

deliveryMethodId: Optional[str] = Field(None, alias="delivery_method_id", ...)

Strict-mode Pydantic v2 rejects the implicit UUID → str cast.

Workaround

Leave the Delivery Method field empty when adding a Deliverable; the request succeeds because delivery_method_id is then null.

Suggested fix

Either coerce the UUID to a string before serialisation (str(uuid) in the frontend layer that builds the request body), or accept UUID on the backend with a coercing validator:

from uuid import UUID
from pydantic import field_validator

deliveryMethodId: Optional[str] = Field(None, alias="delivery_method_id", ...)

@field_validator("deliveryMethodId", mode="before")
@classmethod
def _coerce_uuid_to_str(cls, v):
    return str(v) if isinstance(v, UUID) else v

Environment

  • Ontos deployed via databricks bundle deploy from main (commit synced 2026-05-06)
  • Azure Databricks workspace, OBO auth, Lakebase Autoscaling Postgres
  • Browser: Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions