Tauffer-Consulting / domino

User friendly and open source platform for workflow creation and monitoring
https://domino-workflows.io/
Apache License 2.0
152 stars 14 forks source link

fix: default array object new entries #243

Closed nathan-vm closed 9 months ago

nathan-vm commented 9 months ago

Fix default value of arrays when the inicial array was empty

from pydantic import BaseModel, Field
from typing import List, Optional

class InputObject(BaseModel):
    input_1: str = Field(
        description="input_1 string required.",
        from_upstream="never",
    )
    input_2: Optional[str] = Field(
        default=None,
        description="input_1 string required.",
        from_upstream="allowed",
    )
    input_3: str = Field(
        description="input_3 string required from upstream.",
        from_upstream="always"
    )
class InputModel(BaseModel):
    input_array_object: List[InputObject] = Field(
            default=[],
            description='Input array object to be logged.',
            json_schema_extra={
                'from_upstream':"never"
            }
        )

image