-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Deserializer's "Error. Unknown field" #911
Comments
sthlm58
added a commit
to sthlm58/oatpp
that referenced
this issue
May 1, 2024
To enhance unknown field handling by adding the field's key to the error message, the Caret now stores std::string error message. Resolves oatpp#911
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When having
objectMapper->getDeserializer()->getConfig()->allowUnknownFields = false;
and receiving an unknown field, the error message is a quite genericError. Unknown field
:oatpp/src/oatpp/parser/json/mapping/Deserializer.cpp
Line 468 in bc24a9c
I'd like to enhance it with the actual field name, something like
Error. Unknown field 'foobar'
.However, the
Caret
class is storing only aconst char*
to an error message, and I'd need to store something like astd::string
:oatpp/src/oatpp/core/parser/Caret.cpp
Line 184 in bc24a9c
The actual question is: would you be open to receiving a PR with such an enhancement? And if so, what would be your preferred way of achieving it?
The text was updated successfully, but these errors were encountered: