-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++][Pistache] Serialize integer enums if possible (#16080)
In OpenAPI it is possible to define an enum schema containing integers only. Similar to the following JSON snippet: ``` ... "components": { "schemas": { "size": { "type": "integer", "description": "Container size", "enum": [ 10000, 20000, 100000, 200000, 300000, 1000000, 1200000, 2500000, 5000000, 10000000 ] } } } ... ``` To correctly serialize this we need to convert to JSON integers. We can achieve this by feeding nlohmann JSON objects directly with integers instead of strings. For the C++ pistache server adapt the enum models to serialize integer values if possible.
- Loading branch information
1 parent
e77f9ea
commit 7f480cb
Showing
2 changed files
with
10 additions
and
10 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