Skip to content

Commit

Permalink
style(api): change apidoc example to make it work (#2155)
Browse files Browse the repository at this point in the history
[ANT-1993]
  • Loading branch information
MartinBelthle authored Sep 24, 2024
1 parent 749cb28 commit 1c27c6e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions antarest/study/business/general_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,32 @@ class GeneralFormFields(FormFieldsBaseModel):
geographic_trimming: StrictBool
thematic_trimming: StrictBool

model_config = {
"json_schema_extra": {
"examples": [
{
"mode": "Economy",
"first_day": 1,
"last_day": 365,
"horizon": "2020",
"first_month": "january",
"first_week_day": "Monday",
"first_january": "Monday",
"leap_year": True,
"nb_years": 5,
"building_mode": "Automatic",
"selection_mode": True,
"year_by_year": True,
"simulation_synthesis": True,
"mc_scenario": True,
"filtering": True,
"geographic_trimming": True,
"thematic_trimming": True,
}
]
}
}

@model_validator(mode="before")
def day_fields_validation(cls, values: Union[Dict[str, Any], ValidationInfo]) -> Dict[str, Any]:
new_values = values if isinstance(values, dict) else values.data
Expand Down

0 comments on commit 1c27c6e

Please sign in to comment.