2222# TODO: Validate places where string fields are not allowed to be empty
2323
2424
25- class AnyComponent (BaseModel ):
25+ class AnyComponentSchema (BaseModel ):
2626 id : str = Field (None )
2727 label : str = Field (None )
2828 description : str = Field (None )
@@ -32,48 +32,48 @@ class AnyComponent(BaseModel):
3232 definition : str = Field (None )
3333
3434
35- class DataRecord ( AnyComponent ):
35+ class DataRecordSchema ( AnyComponentSchema ):
3636 type : str = "DataRecord"
37- fields : list [AnyComponent ] = Field (...)
37+ fields : list [AnyComponentSchema ] = Field (...)
3838
3939
40- class Vector ( AnyComponent ):
40+ class VectorSchema ( AnyComponentSchema ):
4141 label : str = "Vector"
4242 type : str = Field (...)
4343 definition : str = Field (...)
4444 reference_frame : str = Field (...)
4545 local_frame : str = Field (None )
4646 # TODO: VERIFY might need to be moved further down when these are defined
47- coordinates : Union [list [Count ], list [Quantity ], list [Time ]] = Field (...)
47+ coordinates : Union [list [CountSchema ], list [QuantitySchema ], list [TimeSchema ]] = Field (...)
4848
4949
50- class DataArray ( AnyComponent ):
50+ class DataArraySchema ( AnyComponentSchema ):
5151 type : str = "DataArray"
5252 element_count : int = Field (..., serialization_alias = 'elementCount' ) # Should type of Count
53- element_type : list [AnyComponent ] = Field (..., serialization_alias = 'elementType' )
53+ element_type : list [AnyComponentSchema ] = Field (..., serialization_alias = 'elementType' )
5454 encoding : str = Field (...) # TODO: implement an encodings class
5555 values : list = Field (None )
5656
5757
58- class Matrix ( AnyComponent ):
58+ class MatrixSchema ( AnyComponentSchema ):
5959 type : str = "Matrix"
6060 element_count : int = Field (..., serialization_alias = 'elementCount' ) # Should be type of Count
61- element_type : list [AnyComponent ] = Field (..., serialization_alias = 'elementType' )
61+ element_type : list [AnyComponentSchema ] = Field (..., serialization_alias = 'elementType' )
6262 encoding : str = Field (...) # TODO: implement an encodings class
6363 values : list = Field (None )
6464 reference_frame : str = Field (None )
6565 local_frame : str = Field (None )
6666
6767
68- class DataChoice ( AnyComponent ):
68+ class DataChoiceSchema ( AnyComponentSchema ):
6969 type : str = "DataChoice"
7070 updatable : bool = Field (False )
7171 optional : bool = Field (False )
72- choice_value : Category = Field (..., serialization_alias = 'choiceValue' ) # TODO: Might be called "choiceValues"
73- items : list [AnyComponent ] = Field (...)
72+ choice_value : CategorySchema = Field (..., serialization_alias = 'choiceValue' ) # TODO: Might be called "choiceValues"
73+ items : list [AnyComponentSchema ] = Field (...)
7474
7575
76- class Geometry ( AnyComponent ):
76+ class GeometrySchema ( AnyComponentSchema ):
7777 label : str = Field (...)
7878 type : str = "Geometry"
7979 updatable : bool = Field (False )
@@ -88,7 +88,7 @@ class Geometry(AnyComponent):
8888 value = Field (None )
8989
9090
91- class AnySimpleComponent ( AnyComponent ):
91+ class AnySimpleComponentSchema ( AnyComponentSchema ):
9292 label : str = Field (...)
9393 description = Field (None )
9494 type : str = Field (...)
@@ -97,31 +97,31 @@ class AnySimpleComponent(AnyComponent):
9797 definition : str = Field (...)
9898 reference_frame : str = Field (None , serialization_alias = 'referenceFrame' )
9999 axis_id : str = Field (None , serialization_alias = 'axisID' )
100- quality : Union [list [Quantity ], list [QuantityRange ], list [Category ], list [Text ]] = Field (
100+ quality : Union [list [QuantitySchema ], list [QuantityRangeSchema ], list [CategorySchema ], list [TextSchema ]] = Field (
101101 None ) # TODO: Union[Quantity, QuantityRange, Category, Text]
102102 nil_values : list = Field (None , serialization_alias = 'nilValues' )
103103 constraint = Field (None )
104104 value = Field (None )
105105
106106
107- class AnyScalarComponent ( AnySimpleComponent ):
107+ class AnyScalarComponentSchema ( AnySimpleComponentSchema ):
108108 """
109109 A base class for all scalar components. The structure is essentially that of AnySimpleComponent
110110 """
111111 pass
112112
113113
114- class Boolean ( AnyScalarComponent ):
114+ class BooleanSchema ( AnyScalarComponentSchema ):
115115 type : str = "Boolean"
116116 value : bool = Field (None )
117117
118118
119- class Count ( AnyScalarComponent ):
119+ class CountSchema ( AnyScalarComponentSchema ):
120120 type : str = "Count"
121121 value : int = Field (None )
122122
123123
124- class Quantity ( AnyScalarComponent ):
124+ class QuantitySchema ( AnyScalarComponentSchema ):
125125 type : str = "Quantity"
126126 value : Union [Real , str ] = Field (None )
127127 uom : Union [UCUMCode , URI ] = Field (...)
@@ -145,46 +145,46 @@ def validate_value(cls, v):
145145 '[NaN, INFINITY, +INFINITY, -INFINITY]' )
146146
147147
148- class Time ( AnyScalarComponent ):
148+ class TimeSchema ( AnyScalarComponentSchema ):
149149 type : str = "Time"
150150 value : str = Field (None )
151151 reference_time : str = Field (None , serialization_alias = 'referenceTime' )
152152 local_frame : str = Field (None )
153153 uom : Union [UCUMCode , URI ] = Field (...)
154154
155155
156- class Category ( AnyScalarComponent ):
156+ class CategorySchema ( AnyScalarComponentSchema ):
157157 type : str = "Category"
158158 value : str = Field (None )
159159 code_space : str = Field (None , serialization_alias = 'codeSpace' )
160160
161161
162- class Text ( AnyScalarComponent ):
162+ class TextSchema ( AnyScalarComponentSchema ):
163163 type : str = "Text"
164164 value : str = Field (None )
165165
166166
167- class CountRange ( AnySimpleComponent ):
167+ class CountRangeSchema ( AnySimpleComponentSchema ):
168168 type : str = "CountRange"
169169 value : list [int ] = Field (None )
170170 uom : Union [UCUMCode , URI ] = Field (...)
171171
172172
173- class QuantityRange ( AnySimpleComponent ):
173+ class QuantityRangeSchema ( AnySimpleComponentSchema ):
174174 type : str = "QuantityRange"
175175 value : list [Union [Real , str ]] = Field (None )
176176 uom : Union [UCUMCode , URI ] = Field (...)
177177
178178
179- class TimeRange ( AnySimpleComponent ):
179+ class TimeRangeSchema ( AnySimpleComponentSchema ):
180180 type : str = "TimeRange"
181181 value : list [str ] = Field (None )
182182 reference_time : str = Field (None , serialization_alias = 'referenceTime' )
183183 local_frame : str = Field (None )
184184 uom : Union [UCUMCode , URI ] = Field (...)
185185
186186
187- class CategoryRange ( AnySimpleComponent ):
187+ class CategoryRangeSchema ( AnySimpleComponentSchema ):
188188 type : str = "CategoryRange"
189189 value : list [str ] = Field (None )
190190 code_space : str = Field (None , serialization_alias = 'codeSpace' )
0 commit comments