Skip to content

Commit

Permalink
feat(sherlock): make sure that fields are of type string for feature …
Browse files Browse the repository at this point in the history
…service provider
  • Loading branch information
stdavis committed Sep 12, 2024
1 parent cca20ed commit 72d1940
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/utah-design-system/src/components/Sherlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 72d1940

Please sign in to comment.