3 ms·
Thanks for your feedback. grumpyrest is not averse to dependency injection, but rather trying to "get out of the way". In particular it does not rely on (autom
by moring 3y ago
Thanks for your feedback.
grumpyrest is not averse to dependency injection, but rather trying to "get out of the way". In particular it does not rely on (automatic) DI. My intention is that you can totally use it in a project that has a DI framework, and at worst it should require you to write the same few lines of glue code that you would need without the DI framework, i.e. calling some constructors.
> Offering to null of all those cases a preferential treatment with a special class is IMO just adding verbosity to the code with longer declarations and unwrapping.
There was a specific reason to give null / missing fields a preferential treatment. If you use a data class like Username that wraps a String, then that class can do all the validation necessary, before the Username reaches the handler method. _Except_ for null and missing fields because the two popular JSON frameworks, Jackson and Guice, already try to bypass that class in those cases. You can configure Jackson to pass null to a Deserializer, but you still cannot distinguish null/missing because they are both a null reference at that point.
Also, AFAIK you cannot say "pass null to the Deserializer only for this type". You have to configure it for the whole ObjectMapper, which is problematic in a DI context where that same ObjectMapper gets used by a lot of code.
- deleted 3y ago[deleted]