You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should change the implementation of the string fields that take in a type, to ensure that yup is able to validate the choices of the field properly. For example
exporttypeServiceIncidentControlChoiceProps=|"Never"|"Pickup"|"Delivery"|"PickupAndDelivery"|"AllExceptShipper";exportenumServiceIncidentControlEnum{Never="Never",Pickup="Pickup",Delivery="Delivery",PickupAndDelivery="PickupAndDelivery",AllExceptShipper="AllExceptShipper",}exportconstserviceIncidentControlChoices=[{value: "Never",label: "Never"},{value: "Pickup",label: "Pickup"},{value: "Delivery",label: "Delivery"},{value: "PickupAndDelivery",label: "Pickup and Delivery"},{value: "AllExceptShipper",label: "All except shipper"},]satisfiesReadonlyArray<IChoiceProps<ServiceIncidentControlChoiceProps>>;
This can be used in yup schemas as follows:
recordServiceIncident: mixed<ServiceIncidentControlEnum>().required("Record Service Incident is required").oneOf(Object.values(ServiceIncidentControlEnum)),
One thing to note is that the API will take care of the validation as well ,but it is good to have some form of client validation as well.
The text was updated successfully, but these errors were encountered:
We should change the implementation of the string fields that take in a type, to ensure that yup is able to validate the choices of the field properly. For example
This can be used in yup schemas as follows:
One thing to note is that the API will take care of the validation as well ,but it is good to have some form of client validation as well.
The text was updated successfully, but these errors were encountered: