Skip to content

Commit

Permalink
#226: Remove allow_population_by_field_name from generated models
Browse files Browse the repository at this point in the history
  • Loading branch information
priscavdsluis committed Sep 27, 2022
1 parent b1c309a commit d59316a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 446 deletions.
5 changes: 1 addition & 4 deletions hydrolib/core/io/rtc/rtcDataConfig/generated/_.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: rtcDataConfig.json
# timestamp: 2022-09-27T13:22:03+00:00
# timestamp: 2022-09-27T13:33:22+00:00

from __future__ import annotations

Expand All @@ -10,7 +10,4 @@


class RtcDataConfig(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: RtcDataConfigComplexType
53 changes: 1 addition & 52 deletions hydrolib/core/io/rtc/rtcDataConfig/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: rtcDataConfig.json
# timestamp: 2022-09-27T13:22:03+00:00
# timestamp: 2022-09-27T13:33:22+00:00

from __future__ import annotations

Expand All @@ -25,44 +25,26 @@ class EnsembleModeEnumStringType(str, Enum):


class ExternalBooleanSimpleTypeItem(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(..., regex='^([\\$][\\(-_a-z]+[\\$])$')


class ExternalBooleanSimpleType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: Union[bool, ExternalBooleanSimpleTypeItem]


class ExternalIntegerSimpleTypeItem(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(..., regex='^([\\$][\\(-_a-z]+[\\$])$')


class ExternalIntegerSimpleType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: Union[int, ExternalIntegerSimpleTypeItem]


class ExternalParameterSimpleTypeItem(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(..., regex='^([#-\\$][\\(-_a-z]+[#-\\$])$')


class ExternalParameterSimpleType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: Union[float, ExternalParameterSimpleTypeItem]


Expand Down Expand Up @@ -94,16 +76,10 @@ class SeparatorEnumStringType(str, Enum):


class TimeSeriesSimpleType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(..., min_length=1)


class TimeZoneSimpleType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: float = Field(
...,
description='The timeZone (in decimal hours shift from GMT)\n e.g. -1.0 or 3.5. If not present GMT is assumed',
Expand All @@ -125,9 +101,6 @@ class VariableTypeEnumStringType(str, Enum):


class DateType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(
..., regex='^([\\d][\\d][\\d][\\d]\\-[\\d][\\d]\\-[\\d][\\d])$'
)
Expand All @@ -154,37 +127,24 @@ class TimeStepUnitEnumStringType(str, Enum):


class TimeType(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str = Field(..., regex='^([\\d][\\d]\\:[\\d][\\d]\\:[\\d][\\d])$')


class XsBoolean(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: bool


class XsPositiveInteger(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: int = Field(..., ge=1)


class XsString(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: str


class CSVTimeSeriesFileComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

attr_adjointOutput: Optional[XsBoolean] = None
attr_decimalSeparator: Optional[SeparatorEnumStringType] = None
Expand All @@ -194,7 +154,6 @@ class Config:
class DateTimeComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

attr_date: DateType
attr_time: TimeType
Expand All @@ -203,7 +162,6 @@ class Config:
class OpenMIExchangeItemComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

elementId: XsString = Field(
..., description='OpenMI element ID, corresponds to the locationId'
Expand All @@ -217,7 +175,6 @@ class Config:
class PITimeSeriesExportFileComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

adjointOutput: Optional[XsBoolean] = None
timeSeriesFile: XsString = Field(
Expand All @@ -232,7 +189,6 @@ class Config:
class PITimeSeriesImportFileComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

timeSeriesFile: XsString = Field(
..., description='Name of the file containing timeseries data. '
Expand All @@ -252,7 +208,6 @@ class TimeStepComplexType(RtcBaseModel):

class Config:
extra = Extra.forbid
allow_population_by_field_name = True

attr_divider: Optional[XsPositiveInteger] = None
attr_multiplier: Optional[XsPositiveInteger] = None
Expand All @@ -267,7 +222,6 @@ class PITimeSeriesComplexType(RtcBaseModel):

class Config:
extra = Extra.forbid
allow_population_by_field_name = True

locationId: XsString = Field(
..., description='Location ID in Delft-FEWS PI-XML file'
Expand Down Expand Up @@ -300,7 +254,6 @@ class RtcTimeSeriesComplexType(RtcBaseModel):

class Config:
extra = Extra.forbid
allow_population_by_field_name = True

attr_id: str = Field(..., min_length=1)
attr_validation: Optional[AttrValidation] = None
Expand All @@ -318,7 +271,6 @@ class Config:
class RtcSeriesExportComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

CSVTimeSeriesFile: Optional[CSVTimeSeriesFileComplexType] = Field(
None,
Expand All @@ -331,7 +283,6 @@ class Config:
class RtcSeriesImportComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

PITimeSeriesFile: Optional[PITimeSeriesImportFileComplexType] = None
timeSeries: List[RtcTimeSeriesComplexType] = Field(..., min_items=1)
Expand All @@ -340,7 +291,6 @@ class Config:
class RtcDataConfigComplexType(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

importSeries: RtcSeriesImportComplexType = Field(
...,
Expand All @@ -359,7 +309,6 @@ class Model(RtcBaseModel):

class Config:
extra = Extra.forbid
allow_population_by_field_name = True

attr_xmlns: Optional[Any] = 'http://www.wldelft.nl/fews'
attr_xmlns_xs: Optional[Any] = Field(
Expand Down
5 changes: 1 addition & 4 deletions hydrolib/core/io/rtc/rtcToolsConfig/generated/_.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: rtcToolsConfig.json
# timestamp: 2022-09-27T13:24:09+00:00
# timestamp: 2022-09-27T13:34:13+00:00

from __future__ import annotations

Expand All @@ -10,9 +10,6 @@


class RtcToolsConfig(RtcBaseModel):
class Config:
allow_population_by_field_name = True

__root__: RtcToolsConfigComplexType


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: rtcToolsConfig.json
# timestamp: 2022-09-27T13:24:09+00:00
# timestamp: 2022-09-27T13:34:13+00:00

from __future__ import annotations

Expand All @@ -15,7 +15,6 @@
class Field1(RtcBaseModel):
class Config:
extra = Extra.forbid
allow_population_by_field_name = True

_: Optional[ExternalParameterSimpleType] = Field(None, alias='$')
attr_useAbsoluteAsSpillCap: Optional[XsBoolean] = None
Loading

0 comments on commit d59316a

Please sign in to comment.