glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
11.77k stars 1.04k forks source link

json scheme to Cpp, enum has no origin order #1289

Open GeneKong opened 4 years ago

GeneKong commented 4 years ago

We want enum with json order input as, but after we give input source:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Test",
    "type": "object",
    "properties": {
        "errorCode": {
            "type": "string",
            "enum": [
                "B",
                "A",
                "E"
            ]
        }
    }
}

but I always get like this:

enum class ErrorCode : int { A, B, E };

    class Test {
        public:
        Test() = default;
        virtual ~Test() = default;

we use this command:

quicktype -l c++ --code-format with-getter-setter --wstring use-string --const-style west-const --type-style pascal-case --member-style camel-case --enumerator-style pascal-case --no-boost -s schema test.json

StephanXu commented 3 years ago

Hi, I met the same problem. Did you find any solution? :(

patrickdejong commented 9 months ago

This issue still exists, any updates?