-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Force custom enum conversion in Json Plugin (#3144)
Since we had the same enum conversion problem a second time I propose to disable the default enum serialization via `JSON_DISABLE_ENUM_SERIALIZATION`. This results in a compile error instead of runtime errors when we actually try to read strings as integers. I set the flag `PRIVATE` in cmake so it does not sneak into user codebases but the user might face the same problems if the includes are not done correctly. Not having the enum and the `NLOHMANN_JSON_SERIALIZE_ENUM` in the same place results in these kind of issues. I wonder if we should rather bring them together and use preprocessor flags. That would also guarantee that the right conversion function will be visible all the time. References: - https://json.nlohmann.me/api/macros/json_disable_enum_serialization/ - https://json.nlohmann.me/api/macros/nlohmann_json_serialize_enum/ Related PRs and issues: - #3142 - #2333 - #2331
- Loading branch information
Showing
5 changed files
with
24 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters