Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YAMLTraits] Fix std::optional input on empty documents (#68947)
When the input document is non-empty, `mapOptional` works as expected, setting `std::optional` to `std::nullopt` when the field is not present. When the input document is empty, we hit a special case inside of `Input::preflightKey` that results in `UseDefault = false`, which results in the `std::optional` erroneously being set to a non-nullopt value. `preflightKey` is changed to set `UseDefault = true` in this case to make the behavior consistent between empty and non-empty documents.
- Loading branch information