diff --git a/src/rad/resources/schemas/reference_files/inverselinearity-1.0.0.yaml b/src/rad/resources/schemas/reference_files/inverselinearity-1.0.0.yaml index dc997572..da260dec 100644 --- a/src/rad/resources/schemas/reference_files/inverselinearity-1.0.0.yaml +++ b/src/rad/resources/schemas/reference_files/inverselinearity-1.0.0.yaml @@ -5,7 +5,7 @@ id: asdf://stsci.edu/datamodels/roman/schemas/reference_files/inverselinearity-1 title: Inverse linearity correction reference schema -datamodel_name: InverseLinearityRefModel +datamodel_name: InverselinearityRefModel type: object properties: diff --git a/tests/test_schemas.py b/tests/test_schemas.py index a94341b1..dcacd034 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -144,6 +144,23 @@ def callback(node): asdf.treeutil.walk(schema, callback) +def _model_name_from_schema_uri(schema_uri): + schema_name = schema_uri.split("/")[-1].split("-")[0] + class_name = "".join([p.capitalize() for p in schema_name.split("_")]) + if schema_uri.startswith("asdf://stsci.edu/datamodels/roman/schemas/reference_files/"): + class_name += "Ref" + + if class_name.startswith("Wfi") and "Ref" not in class_name: + class_name = class_name.split("Wfi")[-1] + + return f"{class_name}Model" + + +def test_datamodel_name(schema): + if "datamodel_name" in schema: + assert _model_name_from_schema_uri(schema["id"]) == schema["datamodel_name"] + + # Confirm that the optical_element filter in wfi_img_photom.yml matches WFI_OPTICAL_ELEMENTS def test_matched_optical_element_entries(): phot_table_keys = list(