Better support a email type #44

Open
opened 2025-11-19 06:25:34 +01:00 by egarette · 0 comments
Owner

If we define a date like this :

$ cat structure4.yml 
%YAML 1.2
---
version: 1.1

my_date:
  type: date
  default: 2025-11-19
...

Pydantic seems to leads directly a date (or YAML?) :

$ rougail -m structure4.yml
ERROR: invalid variable "my_date" in "['structure4.yml']": 6 validation errors for Variable
default.list[nullable[union[bool,int,float,str,Calculation]]]
  Input should be a valid list [type=list_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
default.bool
  Input should be a valid boolean [type=bool_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/bool_type
default.int
  Input should be a valid integer [type=int_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/int_type
default.float
  Input should be a valid number [type=float_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/float_type
default.str
  Input should be a valid string [type=string_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/string_type
default.Calculation
  Input should be a valid dictionary or instance of Calculation [type=model_type, input_value=datetime.date(2025, 11, 19), input_type=date]
    For further information visit https://errors.pydantic.dev/2.9/v/model_type

We should support this structural file (date without quote).

If we define a date like this : ``` $ cat structure4.yml %YAML 1.2 --- version: 1.1 my_date: type: date default: 2025-11-19 ... ``` Pydantic seems to leads directly a date (or YAML?) : ``` $ rougail -m structure4.yml ERROR: invalid variable "my_date" in "['structure4.yml']": 6 validation errors for Variable default.list[nullable[union[bool,int,float,str,Calculation]]] Input should be a valid list [type=list_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/list_type default.bool Input should be a valid boolean [type=bool_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/bool_type default.int Input should be a valid integer [type=int_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/int_type default.float Input should be a valid number [type=float_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/float_type default.str Input should be a valid string [type=string_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/string_type default.Calculation Input should be a valid dictionary or instance of Calculation [type=model_type, input_value=datetime.date(2025, 11, 19), input_type=date] For further information visit https://errors.pydantic.dev/2.9/v/model_type ``` We should support this structural file (date without quote).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stove/rougail#44
No description provided.