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
Our entities / domain model have virtually no validations.
Add invariant checks so that no domain model can be created.
For example, for a user, the phone number must be a valid form, the email must be a valid form, first name and last name must only contain valid characters.
Can possibly add other invariants for Pets and Orders. The invariants to add can be arbitrary.
Also, looking for ideas on how to tie these into Circe serialization.
My current thinking is to have custom decoders that call out to the smart constructors, and somehow translate the ValidatedNels to an appropriate response.
Here is an example...
case class User(...)
object User {
def apply(userName: String, firstName: String ... ): ValidatedNel[String, User] = ...
The text was updated successfully, but these errors were encountered:
I'm not totally fluent with the project yet, but refined-circe could be really useful for validating input to the endpoints. It can do a lot of the heavy lifting to Refined types for you.
Our entities / domain model have virtually no validations.
Add invariant checks so that no domain model can be created.
For example, for a user, the phone number must be a valid form, the email must be a valid form, first name and last name must only contain valid characters.
Can possibly add other invariants for Pets and Orders. The invariants to add can be arbitrary.
Also, looking for ideas on how to tie these into Circe serialization.
My current thinking is to have custom decoders that call out to the smart constructors, and somehow translate the ValidatedNels to an appropriate response.
Here is an example...
The text was updated successfully, but these errors were encountered: