code: public static <T> Mapping<Optional<T>> optional(Mapping<T> base, Constraint... constraints) {
          String mname = "optional " + base.meta().name;
          return new FieldMapping<Optional<T>>(
                  base.options()._inputMode(),
                  ((name, data) -> {
                      logger.debug("optional - converting {}", name);
  
                      if (isEmptyInput(name, data, base.options()._inputMode())) {
                          return Optional.empty();
                      } else return Optional.of(base.convert(name, data));
                  }),
                  ((name, data, messages, options) -> {
                      logger.debug("optional - validating {}", name);
  
                      if (isEmptyInput(name, data, base.options()._inputMode())) {
                          return Collections.emptyList();
                      } else { // merge the optional's constraints/label to base mapping then do validating
                          return base.options(o -> o.append_constraints(options._constraints()))
                                  .options(o -> o._label(o._label().orElse(options._label().orElse(null))))
                                  .validate(name, data, messages, options);
                      }
                  }), new MappingMeta(mname, Optional.class, base)
              ).options(o -> o._ignoreConstraints(true))
                  .constraint(constraints);
          }
docs: (mapping) wrap a base mapping, and return an optional value instead of original value
  @param base base mapping
  @param constraints constraints
  @param <T> base type
  @return new created mapping