Skip to content

Commit c00b4e0

Browse files
add name field to DataArraySchema and update element_count type in MatrixSchema. This version should work as intended with variably sized DataArrays
1 parent a3c1465 commit c00b4e0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

conSys4Py/datamodels/swe_components.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class VectorSchema(AnyComponentSchema):
5151

5252
class DataArraySchema(AnyComponentSchema):
5353
type: str = "DataArray"
54+
name: str = Field(...)
5455
element_count: dict | str | CountSchema = Field(..., serialization_alias='elementCount') # Should type of Count
5556
element_type: SerializeAsAny[list[AnyComponentSchema]] = Field(..., serialization_alias='elementType')
5657
encoding: str = Field(...) # TODO: implement an encodings class
@@ -59,7 +60,7 @@ class DataArraySchema(AnyComponentSchema):
5960

6061
class MatrixSchema(AnyComponentSchema):
6162
type: str = "Matrix"
62-
element_count: int = Field(..., serialization_alias='elementCount') # Should be type of Count
63+
element_count: dict | str | CountSchema = Field(..., serialization_alias='elementCount') # Should be type of Count
6364
element_type: SerializeAsAny[list[AnyComponentSchema]] = Field(..., serialization_alias='elementType')
6465
encoding: str = Field(...) # TODO: implement an encodings class
6566
values: list = Field(None)
@@ -81,10 +82,6 @@ class GeometrySchema(AnyComponentSchema):
8182
updatable: bool = Field(False)
8283
optional: bool = Field(False)
8384
definition: str = Field(...)
84-
# constraint: dict = Field(default_factory=dict(
85-
# geomTypes=[GeometryTypes.POINT.value, GeometryTypes.LINESTRING.value, GeometryTypes.POLYGON.value,
86-
# GeometryTypes.MULTI_POINT.value, GeometryTypes.MULTI_LINESTRING.value,
87-
# GeometryTypes.MULTI_POLYGON.value]))
8885
constraint: dict = Field(default_factory=lambda: {
8986
'geomTypes': [
9087
GeometryTypes.POINT.value,

0 commit comments

Comments
 (0)