@@ -98,6 +98,15 @@ class ValidationRuleName(Enum):
9898 IN_RANGE = "inRange"
9999
100100
101+ class JSONSchemaType (Enum ):
102+ """This enum is the currently supported JSON Schema types"""
103+
104+ STRING = "string"
105+ NUMBER = "number"
106+ INTEGER = "integer"
107+ BOOLEAN = "boolean"
108+
109+
101110class RegexModule (Enum ):
102111 """This enum are allowed modules for the regex validation rule"""
103112
@@ -1636,7 +1645,7 @@ def is_class_in_schema(self, node_label: str) -> bool:
16361645
16371646 def get_node_column_type (
16381647 self , node_label : Optional [str ] = None , node_display_name : Optional [str ] = None
1639- ) -> str :
1648+ ) -> Optional [ JSONSchemaType ] :
16401649 """Gets the column type of the node
16411650
16421651 Args:
@@ -1649,7 +1658,9 @@ def get_node_column_type(
16491658 node_label = self ._get_node_label (node_label , node_display_name )
16501659 rel_node_label = self .dmr .get_relationship_value ("columnType" , "node_label" )
16511660 type_string = self .graph .nodes [node_label ][rel_node_label ]
1652- return type_string
1661+ if type_string is None :
1662+ return type_string
1663+ return JSONSchemaType (type_string )
16531664
16541665 def _get_node_label (
16551666 self , node_label : Optional [str ] = None , node_display_name : Optional [str ] = None
@@ -2767,7 +2778,7 @@ def define_data_model_relationships(self) -> dict:
27672778 "required_header" : False ,
27682779 "edge_rel" : False ,
27692780 "node_attr_dict" : {"default" : None },
2770- "allowed_values" : ["string" , "number" , "integer" , "boolean" ],
2781+ "allowed_values" : [enum . value for enum in JSONSchemaType ],
27712782 },
27722783 }
27732784
@@ -4349,7 +4360,7 @@ class TraversalNode: # pylint: disable=too-many-instance-attributes
43494360 dependencies : list [str ] = field (init = False )
43504361 description : str = field (init = False )
43514362 is_array : bool = field (init = False )
4352- type : str = field (init = False )
4363+ type : Optional [ JSONSchemaType ] = field (init = False )
43534364 format : Optional [JSONSchemaFormat ] = field (init = False )
43544365 minimum : Optional [float ] = field (init = False )
43554366 maximum : Optional [float ] = field (init = False )
@@ -4835,7 +4846,7 @@ def _create_array_property(node: Node) -> Property:
48354846
48364847 items : Items = {}
48374848 if node .type :
4838- items ["type" ] = node .type
4849+ items ["type" ] = node .type . value
48394850 _set_type_specific_keywords (items , node )
48404851
48414852 array_type_dict : TypeDict = {"type" : "array" , "title" : "array" }
@@ -4908,10 +4919,10 @@ def _create_simple_property(node: Node) -> Property:
49084919
49094920 if node .type :
49104921 if node .is_required :
4911- prop ["type" ] = node .type
4922+ prop ["type" ] = node .type . value
49124923 else :
49134924 prop ["oneOf" ] = [
4914- {"type" : node .type , "title" : node .type },
4925+ {"type" : node .type . value , "title" : node .type . value },
49154926 {"type" : "null" , "title" : "null" },
49164927 ]
49174928 elif node .is_required :
0 commit comments