Skip to content

Commit

Permalink
run datamodel-codegen again
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Sep 15, 2023
1 parent f2473a2 commit 54273a0
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 73 deletions.
8 changes: 8 additions & 0 deletions docs/schema/Config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
},
"$ref": "https://deltares.github.io/Ribasim/schema/level_boundary.schema.json"
},
"user": {
"default": {
"static": null,
"time": null
},
"$ref": "https://deltares.github.io/Ribasim/schema/user.schema.json"
},
"pump": {
"default": {
"static": null
Expand Down Expand Up @@ -165,6 +172,7 @@
"level_boundary",
"pump",
"tabulated_rating_curve",
"user",
"flow_boundary",
"basin",
"manning_resistance",
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/DiscreteControlCondition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/FlowBoundaryStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/LevelBoundaryStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/LinearResistanceStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/ManningResistanceStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
16 changes: 8 additions & 8 deletions docs/schema/OutletStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
},
Expand All @@ -22,21 +22,21 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
"min_crest_level": {
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
},
Expand All @@ -63,10 +63,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/PIDControlStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
12 changes: 6 additions & 6 deletions docs/schema/PumpStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
},
Expand All @@ -22,10 +22,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand All @@ -52,10 +52,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "number"
},
{
"type": "number"
"type": "null"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/schema/TabulatedRatingCurveStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "null"
"type": "boolean"
},
{
"type": "boolean"
"type": "null"
}
]
},
Expand Down
29 changes: 14 additions & 15 deletions docs/schema/UserStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,41 @@
},
"priority": {
"format": "default",
"description": "priority",
"type": "integer"
},
"active": {
"format": "default",
"description": "active",
"type": [
"string"
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
},
"demand": {
"format": "double",
"description": "demand",
"type": "number"
},
"return_factor": {
"format": "default",
"description": "return_factor",
"type": "list"
"format": "double",
"type": "number"
},
"min_level": {
"format": "double",
"type": "number"
},
"node_id": {
"format": "default",
"description": "node_id",
"type": "integer"
},
"allocated": {
"format": "double",
"description": "allocated",
"type": "number"
}
},
"required": [
"node_id",
"demand",
"allocated",
"return_factor",
"min_level",
"priority"
],
"$id": "https://deltares.github.io/Ribasim/schema/UserStatic.schema.json",
Expand Down
20 changes: 7 additions & 13 deletions docs/schema/UserTime.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,35 @@
},
"priority": {
"format": "default",
"description": "priority",
"type": "integer"
},
"time": {
"format": "date-time",
"description": "time",
"type": "string"
},
"demand": {
"format": "double",
"description": "demand",
"type": "number"
},
"return_factor": {
"format": "default",
"description": "return_factor",
"type": "list"
"format": "double",
"type": "number"
},
"min_level": {
"format": "double",
"type": "number"
},
"node_id": {
"format": "default",
"description": "node_id",
"type": "integer"
},
"allocated": {
"format": "double",
"description": "allocated",
"type": "number"
}
},
"required": [
"node_id",
"time",
"demand",
"allocated",
"return_factor",
"min_level",
"priority"
],
"$id": "https://deltares.github.io/Ribasim/schema/UserTime.schema.json",
Expand Down
35 changes: 35 additions & 0 deletions docs/schema/user.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"time": {
"format": "default",
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
],
"default": null
},
"static": {
"format": "default",
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
],
"default": null
}
},
"required": [
],
"$id": "https://deltares.github.io/Ribasim/schema/user.schema.json",
"title": "user",
"description": "A user object based on Ribasim.config.user",
"type": "object"
}
8 changes: 8 additions & 0 deletions python/ribasim/ribasim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class LevelBoundary(BaseModel):
static: Optional[str] = None


class User(BaseModel):
time: Optional[str] = None
static: Optional[str] = None


class Pump(BaseModel):
static: Optional[str] = None

Expand Down Expand Up @@ -111,6 +116,9 @@ class Config(BaseModel):
level_boundary: LevelBoundary = Field(
default_factory=lambda: LevelBoundary.parse_obj({"static": None, "time": None})
)
user: User = Field(
default_factory=lambda: User.parse_obj({"static": None, "time": None})
)
pump: Pump = Field(default_factory=lambda: Pump.parse_obj({"static": None}))
discrete_control: DiscreteControl = Field(
default_factory=lambda: DiscreteControl.parse_obj(
Expand Down
Loading

0 comments on commit 54273a0

Please sign in to comment.