From 76130c7ff51420e6e3347aa114892297d77cc039 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 20 Sep 2024 15:37:35 -0400 Subject: [PATCH 1/3] add maxLength matching varchar size --- src/rad/resources/schemas/aperture-1.0.0.yaml | 1 + src/rad/resources/schemas/coordinates-1.0.0.yaml | 1 + src/rad/resources/schemas/ephemeris-1.0.0.yaml | 2 ++ src/rad/resources/schemas/exposure-1.0.0.yaml | 2 ++ src/rad/resources/schemas/guidestar-1.0.0.yaml | 5 +++++ src/rad/resources/schemas/guidewindow-1.0.0.yaml | 3 +++ src/rad/resources/schemas/l2_cal_step-1.0.0.yaml | 15 +++++++++++++++ src/rad/resources/schemas/l3_cal_step-1.0.0.yaml | 4 ++++ src/rad/resources/schemas/mosaic_basic-1.0.0.yaml | 5 +++++ .../resources/schemas/mosaic_wcsinfo-1.0.0.yaml | 1 + src/rad/resources/schemas/observation-1.0.0.yaml | 5 +++++ src/rad/resources/schemas/program-1.0.0.yaml | 5 +++++ src/rad/resources/schemas/ref_file-1.0.0.yaml | 12 ++++++++++++ .../calibration_software_version-1.0.0.yaml | 1 + .../schemas/tagged_scalars/filename-1.0.0.yaml | 1 + .../schemas/tagged_scalars/model_type-1.0.0.yaml | 1 + .../schemas/tagged_scalars/origin-1.0.0.yaml | 1 + .../prd_software_version-1.0.0.yaml | 1 + .../sdf_software_version-1.0.0.yaml | 1 + .../schemas/tagged_scalars/telescope-1.0.0.yaml | 1 + src/rad/resources/schemas/target-1.0.0.yaml | 5 +++++ src/rad/resources/schemas/visit-1.0.0.yaml | 4 ++++ src/rad/resources/schemas/wfi_mode-1.0.0.yaml | 3 +++ 23 files changed, 80 insertions(+) diff --git a/src/rad/resources/schemas/aperture-1.0.0.yaml b/src/rad/resources/schemas/aperture-1.0.0.yaml index 03e6bc5d..0e3523dc 100644 --- a/src/rad/resources/schemas/aperture-1.0.0.yaml +++ b/src/rad/resources/schemas/aperture-1.0.0.yaml @@ -23,6 +23,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:aperture.AperName + maxLength: 40 archive_catalog: datatype: nvarchar(40) destination: [WFIExposure.aperture_name, GuideWindow.aperture_name] diff --git a/src/rad/resources/schemas/coordinates-1.0.0.yaml b/src/rad/resources/schemas/coordinates-1.0.0.yaml index db8cdd82..cc667a90 100644 --- a/src/rad/resources/schemas/coordinates-1.0.0.yaml +++ b/src/rad/resources/schemas/coordinates-1.0.0.yaml @@ -13,6 +13,7 @@ properties: type: string default: ICRS enum: [ICRS] + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.reference_frame, WFIMosaic.reference_frame, GuideWindow.reference_frame] diff --git a/src/rad/resources/schemas/ephemeris-1.0.0.yaml b/src/rad/resources/schemas/ephemeris-1.0.0.yaml index 717ae7a9..adacfb22 100644 --- a/src/rad/resources/schemas/ephemeris-1.0.0.yaml +++ b/src/rad/resources/schemas/ephemeris-1.0.0.yaml @@ -39,6 +39,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.ephemeris_reference_frame, GuideWindow.ephemeris_reference_frame] @@ -64,6 +65,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.ephemeris_type, GuideWindow.ephemeris_type] diff --git a/src/rad/resources/schemas/exposure-1.0.0.yaml b/src/rad/resources/schemas/exposure-1.0.0.yaml index 123e3b92..a5ab65be 100644 --- a/src/rad/resources/schemas/exposure-1.0.0.yaml +++ b/src/rad/resources/schemas/exposure-1.0.0.yaml @@ -15,6 +15,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 25 archive_catalog: datatype: nvarchar(25) destination: [WFIExposure.exposure_type, GuideWindow.exposure_type, WFICommon.exposure_type] @@ -143,6 +144,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 50 archive_catalog: datatype: nvarchar(50) destination: [WFIExposure.ma_table_name, GuideWindow.ma_table_name, WFICommon.ma_table_name] diff --git a/src/rad/resources/schemas/guidestar-1.0.0.yaml b/src/rad/resources/schemas/guidestar-1.0.0.yaml index a0057bfc..6d30f746 100644 --- a/src/rad/resources/schemas/guidestar-1.0.0.yaml +++ b/src/rad/resources/schemas/guidestar-1.0.0.yaml @@ -16,6 +16,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 20 archive_catalog: datatype: nvarchar(20) destination: [WFIExposure.gw_id, GuideWindow.gw_id, WFICommon.gw_id] @@ -25,6 +26,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 18 archive_catalog: datatype: nvarchar(18) destination: [WFIExposure.gw_fgs_mode, GuideWindow.gw_fgs_mode, WFICommon.gw_fgs_mode] @@ -141,6 +143,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 20 archive_catalog: datatype: nvarchar(20) destination: [WFIExposure.gs_id, GuideWindow.gs_id] @@ -153,6 +156,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 20 archive_catalog: datatype: nvarchar(20) destination: [WFIExposure.gs_catalog_version] @@ -295,6 +299,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.gs_epoch, GuideWindow.gs_epoch] diff --git a/src/rad/resources/schemas/guidewindow-1.0.0.yaml b/src/rad/resources/schemas/guidewindow-1.0.0.yaml index e14f5fd7..6fddaa68 100644 --- a/src/rad/resources/schemas/guidewindow-1.0.0.yaml +++ b/src/rad/resources/schemas/guidewindow-1.0.0.yaml @@ -85,6 +85,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: Science Data Formatting + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [GuideWindow.gw_acq_exec_stat] @@ -138,6 +139,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: Science Data Formatting + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [GuideWindow.gw_science_file_source] @@ -147,6 +149,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: Science Data Formatting + maxLength: 18 archive_catalog: datatype: nvarchar(18) destination: [GuideWindow.gw_mode] diff --git a/src/rad/resources/schemas/l2_cal_step-1.0.0.yaml b/src/rad/resources/schemas/l2_cal_step-1.0.0.yaml index 10bdf1f2..c7fdd647 100644 --- a/src/rad/resources/schemas/l2_cal_step-1.0.0.yaml +++ b/src/rad/resources/schemas/l2_cal_step-1.0.0.yaml @@ -13,6 +13,7 @@ properties: science image. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_assign_wcs] @@ -25,6 +26,7 @@ properties: flatfield reference image. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_flat_field] @@ -35,6 +37,7 @@ properties: dark current reference data from science data. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_dark] @@ -45,6 +48,7 @@ properties: using the MASK reference file is initialized. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_dq_init] @@ -55,6 +59,7 @@ properties: The data are converted from DN/s to MJy/sr. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_flux] @@ -65,6 +70,7 @@ properties: may be associated with cosmic rays. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_jump] @@ -75,6 +81,7 @@ properties: detector response. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_linearity] @@ -85,6 +92,7 @@ properties: data product. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_photom] @@ -94,6 +102,7 @@ properties: Step in ROMANCAL to detect point sources in an image and catalog them. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_source_detection] @@ -104,6 +113,7 @@ properties: thus estimate the count rate for each pixel. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_ramp_fit] @@ -114,6 +124,7 @@ properties: contributing to (e.g. 1/f noise) using the reference pixels. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_refpix] @@ -125,6 +136,7 @@ properties: or negative are also flagged. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_saturation] @@ -134,6 +146,7 @@ properties: Step in ROMANCAL which detects and flags outliers in a science image. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_outlier_detection] @@ -145,6 +158,7 @@ properties: World Coordinate System alignment. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_tweakreg] @@ -155,6 +169,7 @@ properties: and derives scalings to equalize overlapping regions. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_skymatch] diff --git a/src/rad/resources/schemas/l3_cal_step-1.0.0.yaml b/src/rad/resources/schemas/l3_cal_step-1.0.0.yaml index 4fd9100f..48168e7c 100644 --- a/src/rad/resources/schemas/l3_cal_step-1.0.0.yaml +++ b/src/rad/resources/schemas/l3_cal_step-1.0.0.yaml @@ -13,6 +13,7 @@ properties: The data are converted from DN/s to MJy/sr. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_flux] @@ -22,6 +23,7 @@ properties: Step in ROMANCAL which detects and flags outliers in a science image. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_outlier_detection] @@ -32,6 +34,7 @@ properties: and derives scalings to equalize overlapping regions. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_skymatch] @@ -43,6 +46,7 @@ properties: multiple resampled images into a single, undistorted product. type: string enum: ['N/A', 'COMPLETE', 'SKIPPED', 'INCOMPLETE'] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [ScienceRefData.s_resample] diff --git a/src/rad/resources/schemas/mosaic_basic-1.0.0.yaml b/src/rad/resources/schemas/mosaic_basic-1.0.0.yaml index 08396b68..d3622741 100644 --- a/src/rad/resources/schemas/mosaic_basic-1.0.0.yaml +++ b/src/rad/resources/schemas/mosaic_basic-1.0.0.yaml @@ -104,6 +104,7 @@ properties: survey: title: Observation Survey type: string + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [WFIMosaic.survey, SourceCatalog.survey, SegmentationMap.survey] @@ -113,6 +114,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 20 archive_catalog: datatype: nvarchar(20) destination: [WFIMosaic.optical_element, SourceCatalog.optical_element, SegmentationMap.optical_element] @@ -124,6 +126,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 5 archive_catalog: datatype: nvarchar(5) destination: [WFIMosaic.instrument_name, SourceCatalog.instrument_name, SegmentationMap.instrument_name] @@ -134,6 +137,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 25 archive_catalog: datatype: nvarchar(25) destination: [WFIMosaic.location_name, SourceCatalog.location_name, SegmentationMap.location_name] @@ -144,6 +148,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 25 archive_catalog: datatype: nvarchar(25) destination: [WFIMosaic.product_type, SourceCatalog.product_type, SegmentationMap.product_type] diff --git a/src/rad/resources/schemas/mosaic_wcsinfo-1.0.0.yaml b/src/rad/resources/schemas/mosaic_wcsinfo-1.0.0.yaml index 85e81768..b3c5c422 100644 --- a/src/rad/resources/schemas/mosaic_wcsinfo-1.0.0.yaml +++ b/src/rad/resources/schemas/mosaic_wcsinfo-1.0.0.yaml @@ -89,6 +89,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 50 archive_catalog: datatype: nvarchar(50) destination: [WFIMosaic.projection] diff --git a/src/rad/resources/schemas/observation-1.0.0.yaml b/src/rad/resources/schemas/observation-1.0.0.yaml index 5d1e73f0..7ab91183 100644 --- a/src/rad/resources/schemas/observation-1.0.0.yaml +++ b/src/rad/resources/schemas/observation-1.0.0.yaml @@ -22,6 +22,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 28 archive_catalog: datatype: nvarchar(28) destination: [WFIExposure.obs_id, GuideWindow.obs_id] @@ -37,6 +38,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 19 archive_catalog: datatype: nvarchar(19) destination: [WFIExposure.visit_id, GuideWindow.visit_id] @@ -154,6 +156,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 2 archive_catalog: datatype: nvarchar(2) destination: [WFIExposure.visit_file_activity, GuideWindow.visit_file_activity] @@ -179,6 +182,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_visit.template + maxLength: 50 archive_catalog: datatype: nvarchar(50) destination: [WFIExposure.template, GuideWindow.template] @@ -203,6 +207,7 @@ properties: survey not otherwise defined here. type: string enum: [HLS, EMS, SN, N/A] + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [WFIExposure.survey, GuideWindow.survey] diff --git a/src/rad/resources/schemas/program-1.0.0.yaml b/src/rad/resources/schemas/program-1.0.0.yaml index 25cd7495..d5dc6b72 100644 --- a/src/rad/resources/schemas/program-1.0.0.yaml +++ b/src/rad/resources/schemas/program-1.0.0.yaml @@ -15,6 +15,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_program.title + maxLength: 200 archive_catalog: datatype: nvarchar(200) destination: [WFIExposure.program_title, WFIMosaic.program_title, GuideWindow.program_title, @@ -30,6 +31,7 @@ properties: # There are a number of ways to get the pi_name. Here is one # of them: "= apt('./ProposalInformation/PrincipalInvestigator/InvestigatorAddress/LastName') + ', ' + apt('./ProposalInformation/PrincipalInvestigator/InvestigatorAddress/FirstName')" origin: TBD + maxLength: 100 archive_catalog: datatype: nvarchar(100) destination: [WFIExposure.pi_name, WFIMosaic.pi_name, GuideWindow.pi_name, @@ -43,6 +45,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_program.category + maxLength: 6 archive_catalog: datatype: nvarchar(6) destination: [WFIExposure.program_category, WFIMosaic.program_category, GuideWindow.program_category, @@ -56,6 +59,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_program.subcategory + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [WFIExposure.program_subcategory, WFIMosaic.program_subcategory, GuideWindow.program_subcategory, @@ -70,6 +74,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_program.science_category + maxLength: 50 archive_catalog: datatype: nvarchar(50) destination: [WFIExposure.science_category, WFIMosaic.science_category, GuideWindow.science_category, diff --git a/src/rad/resources/schemas/ref_file-1.0.0.yaml b/src/rad/resources/schemas/ref_file-1.0.0.yaml index 03d603ca..5aa0c593 100644 --- a/src/rad/resources/schemas/ref_file-1.0.0.yaml +++ b/src/rad/resources/schemas/ref_file-1.0.0.yaml @@ -21,6 +21,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.crds_software_version, WFIMosaic.crds_software_version, @@ -35,6 +36,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.crds_context_used, WFIMosaic.crds_context_used, @@ -45,6 +47,7 @@ properties: Reference file used to correct for the dark current contribution to science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_dark, GuideWindow.r_dark, WFICommon.r_dark] @@ -54,6 +57,7 @@ properties: Information about the distortion reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_distortion, GuideWindow.r_distortion, WFICommon.r_distortion] @@ -62,6 +66,7 @@ properties: description: | Information about the mask reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_mask, GuideWindow.r_mask, WFICommon.r_mask] @@ -70,6 +75,7 @@ properties: description: | Information about the flat reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_flat, GuideWindow.r_flat, WFICommon.r_flat] @@ -78,6 +84,7 @@ properties: description: | Information about the gain reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_gain, GuideWindow.r_gain, WFICommon.r_gain] @@ -87,6 +94,7 @@ properties: Information about the read noise reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_readnoise, GuideWindow.r_readnoise, WFICommon.r_readnoise] @@ -95,6 +103,7 @@ properties: description: | Information about the linearity reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_linearity, GuideWindow.r_linearity, WFICommon.r_linearity] @@ -104,6 +113,7 @@ properties: Information about the photometry reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_photom, GuideWindow.r_photom, WFICommon.r_photom] @@ -112,6 +122,7 @@ properties: description: | Information about the area reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_area, GuideWindow.r_area, WFICommon.r_area] @@ -121,6 +132,7 @@ properties: Information about the saturation reference file used with the science data. type: string + maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [ScienceRefData.r_saturation, GuideWindow.r_saturation, WFICommon.r_saturation] diff --git a/src/rad/resources/schemas/tagged_scalars/calibration_software_version-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/calibration_software_version-1.0.0.yaml index 00953614..70e6b71e 100644 --- a/src/rad/resources/schemas/tagged_scalars/calibration_software_version-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/calibration_software_version-1.0.0.yaml @@ -9,6 +9,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.calibration_software_version, GuideWindow.calibration_software_version, diff --git a/src/rad/resources/schemas/tagged_scalars/filename-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/filename-1.0.0.yaml index 5038390e..d35a080d 100644 --- a/src/rad/resources/schemas/tagged_scalars/filename-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/filename-1.0.0.yaml @@ -9,6 +9,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.filename, WFIMosaic.filename, GuideWindow.filename, WFICommon.filename, diff --git a/src/rad/resources/schemas/tagged_scalars/model_type-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/model_type-1.0.0.yaml index eb8af109..5500cbb3 100644 --- a/src/rad/resources/schemas/tagged_scalars/model_type-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/model_type-1.0.0.yaml @@ -9,6 +9,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 50 archive_catalog: datatype: nvarchar(50) destination: [WFIExposure.model_type, GuideWindow.model_type, WFICommon.model_type, WFIMosaic.model_type, diff --git a/src/rad/resources/schemas/tagged_scalars/origin-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/origin-1.0.0.yaml index ed2dc949..d5096f7c 100644 --- a/src/rad/resources/schemas/tagged_scalars/origin-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/origin-1.0.0.yaml @@ -12,6 +12,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [WFIExposure.origin, GuideWindow.origin, WFICommon.origin, WFIMosaic.origin, diff --git a/src/rad/resources/schemas/tagged_scalars/prd_software_version-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/prd_software_version-1.0.0.yaml index d9421103..a49b9c95 100644 --- a/src/rad/resources/schemas/tagged_scalars/prd_software_version-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/prd_software_version-1.0.0.yaml @@ -9,6 +9,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.prd_software_version, GuideWindow.prd_software_version, diff --git a/src/rad/resources/schemas/tagged_scalars/sdf_software_version-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/sdf_software_version-1.0.0.yaml index dc84ae82..3a9bfa01 100644 --- a/src/rad/resources/schemas/tagged_scalars/sdf_software_version-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/sdf_software_version-1.0.0.yaml @@ -9,6 +9,7 @@ sdf: special_processing: VALUE_REQUIRED source: origin: TBD +maxLength: 120 archive_catalog: datatype: nvarchar(120) destination: [WFIExposure.sdf_software_version, GuideWindow.sdf_software_version, diff --git a/src/rad/resources/schemas/tagged_scalars/telescope-1.0.0.yaml b/src/rad/resources/schemas/tagged_scalars/telescope-1.0.0.yaml index ae5f1320..f8520870 100644 --- a/src/rad/resources/schemas/tagged_scalars/telescope-1.0.0.yaml +++ b/src/rad/resources/schemas/tagged_scalars/telescope-1.0.0.yaml @@ -8,6 +8,7 @@ title: Telescope Name type: string enum: [ROMAN] +maxLength: 5 archive_catalog: datatype: nvarchar(5) destination: [WFIExposure.telescope, WFIMosaic.telescope, GuideWindow.telescope, WFICommon.telescope, diff --git a/src/rad/resources/schemas/target-1.0.0.yaml b/src/rad/resources/schemas/target-1.0.0.yaml index 55569039..858b431f 100644 --- a/src/rad/resources/schemas/target-1.0.0.yaml +++ b/src/rad/resources/schemas/target-1.0.0.yaml @@ -15,6 +15,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_target.target_name + maxLength: 100 archive_catalog: datatype: nvarchar(100) destination: [WFIExposure.proposer_target_name, GuideWindow.proposer_target_name] @@ -27,6 +28,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_target.standard_target_name + maxLength: 256 archive_catalog: datatype: nvarchar(256) destination: [WFIExposure.catalog_name, GuideWindow.catalog_name] @@ -45,6 +47,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_target.target_type + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.target_type, GuideWindow.target_type] @@ -134,6 +137,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_visit.epoch + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.proper_motion_epoch, GuideWindow.proper_motion_epoch] @@ -178,6 +182,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 8 archive_catalog: datatype: nvarchar(8) destination: [WFIExposure.source_type, GuideWindow.source_type] diff --git a/src/rad/resources/schemas/visit-1.0.0.yaml b/src/rad/resources/schemas/visit-1.0.0.yaml index 3d9e0c97..f0db478a 100644 --- a/src/rad/resources/schemas/visit-1.0.0.yaml +++ b/src/rad/resources/schemas/visit-1.0.0.yaml @@ -18,6 +18,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.engineering_quality, GuideWindow.engineering_quality, @@ -33,6 +34,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.pointing_engdb_quality, GuideWindow.pointing_engdb_quality, @@ -46,6 +48,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: PSS:dms_visit.visit_type + maxLength: 30 archive_catalog: datatype: nvarchar(30) destination: [WFIExposure.visit_type, GuideWindow.visit_type, @@ -85,6 +88,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 15 archive_catalog: datatype: nvarchar(15) destination: [WFIExposure.visit_status, GuideWindow.visit_status, diff --git a/src/rad/resources/schemas/wfi_mode-1.0.0.yaml b/src/rad/resources/schemas/wfi_mode-1.0.0.yaml index 2cc3b9c4..6644180a 100644 --- a/src/rad/resources/schemas/wfi_mode-1.0.0.yaml +++ b/src/rad/resources/schemas/wfi_mode-1.0.0.yaml @@ -17,6 +17,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 5 archive_catalog: datatype: nvarchar(5) destination: [WFIExposure.instrument_name, GuideWindow.instrument_name, WFICommon.instrument_name] @@ -29,6 +30,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 10 archive_catalog: datatype: nvarchar(10) destination: [WFIExposure.detector, GuideWindow.detector, WFICommon.detector] @@ -41,6 +43,7 @@ properties: special_processing: VALUE_REQUIRED source: origin: TBD + maxLength: 20 archive_catalog: datatype: nvarchar(20) destination: [WFIExposure.optical_element, GuideWindow.optical_element, WFICommon.optical_element] From 8a138fe2d4d837b21265604114ee3dc06ef6efd4 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 20 Sep 2024 16:16:29 -0400 Subject: [PATCH 2/3] add test that maxLength and nvarchar match --- tests/test_schemas.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 3bf429eb..dce7814a 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -260,3 +260,37 @@ def test_reftype_tag(ref_file_uris): assert asdf.util.uri_match(f"asdf://stsci.edu/datamodels/roman/tags/reference_files/*{reftype}-*", tag_uri) assert asdf.util.uri_match(f"asdf://stsci.edu/datamodels/roman/schemas/reference_files/*{reftype}-*", schema_uri) + + +# don't test tvac or fps schemas as they are static +@pytest.mark.parametrize( + "uri", + [ + uri + for uri in SCHEMA_URIS + if not uri.startswith("asdf://stsci.edu/datamodels/roman/schemas/fps/") + and not uri.startswith("asdf://stsci.edu/datamodels/roman/schemas/tvac/") + ], +) +def test_varchar_length(uri): + """ + Test that varchar(N) in archive_metadata for string objects + has a matching maxLength: N validation keyword + """ + schema = asdf.schema.load_schema(uri) + + def callback(node, nvarchars={}): + if not isinstance(node, dict): + return + if node.get("type", "") != "string": + return + if "archive_catalog" not in node: + return + m = re.match(r"^nvarchar\(([0-9]+)\)$", node["archive_catalog"]["datatype"]) + if not m: + return + v = int(m.group(1)) + assert "maxLength" in node, f"archive_catalog has nvarchar, schema {uri} is missing maxLength" + assert node["maxLength"] == v, f"archive_catalog nvarchar does not match maxLength in schema {uri}" + + asdf.treeutil.walk(schema, callback) From 057bf92187c545f8d613c2869c6d4b801be2c379 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 20 Sep 2024 16:36:41 -0400 Subject: [PATCH 3/3] add changelog fragment --- changes/448.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/448.feature.rst diff --git a/changes/448.feature.rst b/changes/448.feature.rst new file mode 100644 index 00000000..11a9f914 --- /dev/null +++ b/changes/448.feature.rst @@ -0,0 +1 @@ +Add maxLength keywords to schemas matching nvarchar archive_catalog datatypes.