Skip to content

Serialize enum#5151

Open
nugentcaillin wants to merge 5 commits intonlohmann:developfrom
nugentcaillin:serialize-enum
Open

Serialize enum#5151
nugentcaillin wants to merge 5 commits intonlohmann:developfrom
nugentcaillin:serialize-enum

Conversation

@nugentcaillin
Copy link
Copy Markdown

[Describe your pull request here. Please read the text below the line and make sure you follow the checklist.]

  • The changes are described in detail, both the what and why.
  • If applicable, an existing issue is referenced.
  • The Code coverage remained at 100%. A test case for every new line of code.
  • If applicable, the documentation is updated.
  • The source code is amalgamated by running make amalgamate.

Read the Contribution Guidelines for detailed information.

  • added NLOHMANN_SERIALIZE_ENUM_STRICT to throw error on unrecognized enum values, solving 3992.
  • Added new unit tests to verify behavior.
  • updated documentation where NLOHMANN_SERIALIZE_ENUM to mention alongside warning that a throwing version exists - i didn't add a separate page for it as it is very close functionally to NLOHMANN_SERIALIZE_ENUM, but can add.

I wasn't able to call JSON_THROW inside detail/macro_scope.hpp, so this PR may have issues when exceptions are disabled - but am unsure if this is an issue if this macro has been added with the purpose of throwing - I'd appreciate some guidance on how to proceed here.

- duplicate of NLOHMANN_JSON_SERIALIZE_ENUM

Signed-off-by: Caillin Nugent <caillinn@student.unimelb.edu.au>
Signed-off-by: Caillin Nugent <caillinn@student.unimelb.edu.au>
Signed-off-by: Caillin Nugent <caillinn@student.unimelb.edu.au>
…LIZE_ENUM_STRICT

Signed-off-by: Caillin Nugent <caillinn@student.unimelb.edu.au>
Signed-off-by: Caillin Nugent <caillinn@student.unimelb.edu.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant