Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++][Pistache] Serialize integer enums if possible #16080

Merged

Commits on Jul 12, 2023

  1. [C++][Pistache] Serialize integer enums if possible

    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.
    CTerasa-ep committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    d7025b4 View commit details
    Browse the repository at this point in the history