Open dbofmmbt opened 3 years ago
That sounds like a good idea!
Having an option to skip validation would be nice in case someone deals with validation elsewhere. How would this proposal look like in this case ? Although, if parsing end up being cheap, this might not be needed at all.
That's a valid concern, but allowing to skip validation on the newtype's construction could be bad to reliability. Someone could pass data which was not properly validated. Since the type should uphold this guarantee, the rest of the system could behave in unexpected ways.
Would be good to know if an option to skip validation is common in the ecosystem and how it's done.
It's worth pointing that this resource wouldn't be a breaking change to that type if added after.
In terms of validation, there are at least two ways I believe should be acceptable (since all services support them both): 20940040 20940-040
Hey, looking at the API I wondered if adding a
CEP
type would be a good idea. The type would be a guarantee that the inner&str
looks like an address. You could receive a&CEP
instead of a&str
inget_address
.Something like: