Backstopper is a framework-agnostic API error handling and (optional) model validation solution for Java 17 and greater.
(NOTE: The Backstopper 1.x branch contains a version of
Backstopper for Java 7+, and for the javax
ecosystem. The current Backstopper supports Java 17+ and the jakarta
ecosystem.)
This library contains some helper classes for working in an environment that uses Jackson with Backstopper.
JsonUtilWithDefaultErrorContractDTOSupport
- A general-purpose JSON serializer that has built-in support for the default Backstopper error contract DTO. In particular:- If an error code is parseable to an integer then the JSON field for that error code will be serialized as a number rather than a string.
- If an error has an empty metadata section then it will be omitted from the serialized JSON.
- You can create a Jackson
ObjectMapper
with any combination of the above rules turned on or off by using thegenerateErrorContractObjectMapper(...)
static factory method.
See the base project README.md, User Guide, and Backstopper repository source code and javadocs for all further information.
Backstopper is released under the Apache License, Version 2.0