orisai / object-mapper

Raw data mapping to validated objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trimming empty string values

mabar opened this issue · comments

Description

Add trimming string values to support error-prone user-given form inputs

  • StringValue() - parameter trim=bool, default false
  • Rules casting from string should also trim value, when casting is enabled (without any additional option). Specifically BoolValue() castBoolLike, FloatValue() castNumericString, IntValue() castNumericString, NullValue() castEmptyString
  • Options dynamic context to change all of above dynamically in runtime. e.g. StringDynamicContext with trim=true would enable all processed StringValue() to trim values. trim=false would disable all. Differentiating between implicit and explicit parameters is probably not needed.

Addition information

cc @mrceperka

Related issues

No response