diff --git a/api/openapi.generated.yml b/api/openapi.generated.yml index f8ba0f216..1aa0cfefc 100644 --- a/api/openapi.generated.yml +++ b/api/openapi.generated.yml @@ -2091,8 +2091,7 @@ components: type: string format: uuid description: The ID of the saved search - example: !!python/object:uuid.UUID - int: 82637552140693101888240202082641616217 + example: 123e4567-e89b-12d3-a456-426614174000 name: type: string description: Name of the saved search diff --git a/api/src/api/schemas/extension/schema_fields.py b/api/src/api/schemas/extension/schema_fields.py index 8431c3ecd..8f4035afa 100644 --- a/api/src/api/schemas/extension/schema_fields.py +++ b/api/src/api/schemas/extension/schema_fields.py @@ -1,7 +1,6 @@ import copy import enum import typing -import uuid from apiflask import fields as original_fields from marshmallow import ValidationError @@ -133,7 +132,12 @@ class UUID(original_fields.UUID, MixinField): def __init__(self, **kwargs: typing.Any): super().__init__(**kwargs) - self.metadata["example"] = uuid.uuid4() + + # Set a default value for the UUID if none supplied + example_value = kwargs.get("metadata", {}).get( + "example", "123e4567-e89b-12d3-a456-426614174000" + ) + self.metadata["example"] = example_value class Date(original_fields.Date, MixinField):