@@ -616,6 +616,62 @@ def test_create_json_schema_with_display_names(
616616 assert expected_json == test_json
617617
618618
619+
620+ def test_create_json_schema_with_no_column_type (
621+ dmge : DataModelGraphExplorer , test_directory : str
622+ ) -> None :
623+ """
624+ Tests for JSONSchemaGenerator.create_json_schema
625+ This tests where the data model does not have columnType attribute
626+ """
627+ datatype = "JSONSchemaComponent"
628+ test_file = f"test.{ datatype } .display_names_schema.json"
629+ test_path = os .path .join (test_directory , test_file )
630+ expected_path = (
631+ f"tests/data/expected_jsonschemas/expected.{ datatype } .schema.json"
632+ )
633+ create_json_schema (
634+ dmge = dmge ,
635+ datatype = datatype ,
636+ schema_name = f"{ datatype } _validation" ,
637+ schema_path = test_path ,
638+ use_property_display_names = False ,
639+ )
640+ with open (expected_path , encoding = "utf-8" ) as file1 , open (
641+ test_path , encoding = "utf-8"
642+ ) as file2 :
643+ expected_json = json .load (file1 )
644+ test_json = json .load (file2 )
645+ assert expected_json == test_json
646+
647+ def test_create_json_schema_with_column_type (
648+ dmge_column_type : DataModelGraphExplorer , test_directory : str
649+ ) -> None :
650+ """
651+ Tests for JSONSchemaGenerator.create_json_schema
652+ This tests where the data model does have the columnType attribute
653+ """
654+ datatype = "JSONSchemaComponent"
655+ test_file = f"test.{ datatype } .display_names_schema.json"
656+ test_path = os .path .join (test_directory , test_file )
657+ expected_path = (
658+ f"tests/data/expected_jsonschemas/expected.{ datatype } .schema.json"
659+ )
660+ create_json_schema (
661+ dmge = dmge_column_type ,
662+ datatype = datatype ,
663+ schema_name = f"{ datatype } _validation" ,
664+ schema_path = test_path ,
665+ use_property_display_names = False ,
666+ )
667+ with open (expected_path , encoding = "utf-8" ) as file1 , open (
668+ test_path , encoding = "utf-8"
669+ ) as file2 :
670+ expected_json = json .load (file1 )
671+ test_json = json .load (file2 )
672+ assert expected_json == test_json
673+
674+
619675@pytest .mark .parametrize (
620676 "instance_path, datatype" ,
621677 [
0 commit comments