Skip to content

map<json::value_t, string> exhibits unexpected behavior #1387

@RPGillespie6

Description

@RPGillespie6
  • What is the issue you have?
    map<json::value_t, string> exhibits unexpected behavior

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

#include <iostream>
#include <json.hpp>

using namespace std;
using nlohmann::json;

static map<json::value_t, string> nlohmann_to_openapi {
    {json::value_t::null,            "null"},
    {json::value_t::boolean,         "boolean"},
    {json::value_t::string,          "string"},
    {json::value_t::number_integer,  "integer"},
    {json::value_t::number_unsigned, "integer"},
    {json::value_t::number_float,    "number"},
    {json::value_t::object,          "object"},
    {json::value_t::array,           "array"}
};

int main()
{
    cout << nlohmann_to_openapi.at(json::value_t::number_float) << endl;
}
  • What is the expected behavior?
    "number"

  • And what is the actual behavior instead?
    "integer"

  • Which compiler and operating system are you using? Is it a supported compiler?
    gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
    Ubuntu 18.04

  • Did you use a released version of the library or the version from the develop branch?
    Tried various official released as well as the latest on master

  • If you experience a compilation error: can you compile and run the unit tests?
    n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions