JSON mapping options. More...
#include <mappingOptions.hpp>
Public Attributes | |
| bool | serialize_empty_col = true |
| bool | serialize_null = false |
| uint16_t | prettify_nbs = 0 |
| bool | serialize_check_constraints = false |
| bool | deserialize_ignore_unknown_field = false |
| int64_t | deserialize_max_discard_char = 0 |
| std::size_t | max_payload = 0 |
| bool | deserialize_check_constraints = true |
| std::size_t | max_depth = 512 |
| std::size_t | buffer_size = 1024 |
JSON mapping options.
Options are used to serialization options and deserialization behavior on unexcepted input stream
| std::size_t anch::json::MappingOptions::buffer_size = 1024 |
Buffer size (used for deserialization for now)
| bool anch::json::MappingOptions::deserialize_check_constraints = true |
Check fields constraints ( required , minLength , minimum , ... given to ObjectMapper::registerField ) after reading values: anch::json::MappingError is raised with MISSING_FIELD or CONSTRAINT_VIOLATION error code. Default to true : usually enabled on server side to refuse invalid requests, disabled on client side where server responses are trusted.
| bool anch::json::MappingOptions::deserialize_ignore_unknown_field = false |
Unknown will not raise error if true ; it can be usefull for client side implementation
| int64_t anch::json::MappingOptions::deserialize_max_discard_char = 0 |
Maximum discard characters before raising error. Use -1 value for unlimited discard characters. It can be usefull at development stage
| std::size_t anch::json::MappingOptions::max_depth = 512 |
Maximum nesting depth of objects and arrays (root object or array is level 1 ) before raising error. It protects parser against stack overflow. Use 0 value for unlimited depth. Default to 512
| std::size_t anch::json::MappingOptions::max_payload = 0 |
Maximum number of characters read from input stream before raising error ( anch::json::ErrorCode::PAYLOAD_TOO_LARGE ). Use 0 value for unlimited payload. The length of a string field is limited with its maxLength constraint.
| uint16_t anch::json::MappingOptions::prettify_nbs = 0 |
Serialization indentation number of spaces (0 means no prettifying). Default to 0
| bool anch::json::MappingOptions::serialize_check_constraints = false |
Check fields constraints ( minLength , minimum , ... given to ObjectMapper::registerField ) before writing values: anch::json::MappingError is raised with CONSTRAINT_VIOLATION error code (the output stream contains the JSON written before the error). Default to false : usually enabled on client side to not send invalid requests, disabled on server side where responses are built by the server itself.
Required fields are always written ( null , [] or {} when empty, whatever serialize_null and serialize_empty_col options are).
| bool anch::json::MappingOptions::serialize_empty_col = true |
Serialize empty collection as [] or {} for map . Default to true ; std::optional or pointer can be used
| bool anch::json::MappingOptions::serialize_null = false |
Serialize null or empty string as null . Default to false