Skip to content

Heterogeneous Arrays(Tuples) #22

Open
@alpaylan

Description

@alpaylan

Hi,

In some cases, I tend to deal with heterogenous arrays that are used more as tuples in my use case.

{
    "a": [
        {"b": 1},
        {"c": 2},
        {"d": 3}
    ]
}

jtd-infer works great with such a case, producing
{"properties":{"a":{"elements":{"optionalProperties":{"b":{"type":"uint8"},"c":{"type":"uint8"},"d":{"type":"uint8"}}}}}}

but when I make one of the elements of the tuple another array

{
    "a": [
        {"b": 1},
        [1, 2],
        {"d": 3}
    ]
}

I get a blank for the entire array

{"properties":{"a":{"elements":{}}}}

Is that the expected behavior? Would you be open to changing it?

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