From 72d19407ed08f83560a5e50dd0947d74305d09f2 Mon Sep 17 00:00:00 2001 From: stdavis Date: Thu, 12 Sep 2024 14:19:06 -0600 Subject: [PATCH] feat(sherlock): make sure that fields are of type string for feature service provider --- .../utah-design-system/src/components/Sherlock.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/utah-design-system/src/components/Sherlock.jsx b/packages/utah-design-system/src/components/Sherlock.jsx index 60ddfb0e..4d75aaac 100644 --- a/packages/utah-design-system/src/components/Sherlock.jsx +++ b/packages/utah-design-system/src/components/Sherlock.jsx @@ -231,12 +231,21 @@ export const featureServiceProvider = ( let searchFieldValidated = false; let contextFieldValidated = false; for (const field of serviceJson.fields) { - // todo: validate that field types are string if (field.name === searchField) { + if (field.type !== 'esriFieldTypeString') { + throw new Error( + `Field: ${searchField} must be of type "esriFieldTypeString"`, + ); + } searchFieldValidated = true; } if (contextField && field.name === contextField) { + if (field.type !== 'esriFieldTypeString') { + throw new Error( + `Field: ${contextField} must be of type "esriFieldTypeString"`, + ); + } contextFieldValidated = true; } }