Skip to content

Integer constants as enums #42

@rhacking

Description

@rhacking

As far as I can see, there's no way of parsing target as an enum in the following example:

    "bufferViews": [
        {
            "buffer": 0,
            "byteOffset": 576,
            "byteLength": 72,
            "target": 34963
        },
        {
            "buffer": 0,
            "byteOffset": 0,
            "byteLength": 576,
            "byteStride": 12,
            "target": 34962
        }
    ],

The following results in [haxe] invalid use of @:json

enum BufferTarget {
    @:json(34963) ElementArrayBuffer;
    @:json(34962) ArrayBuffer;
}

Right now I'm using an enum abstract, but I think it would be more elegant if something like the above were possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions