Skip to content

Combing arrays and anyOf #1439

@brockjenken

Description

@brockjenken

Describe the bug
When using api schema that use arrays nested in an anyOf, it takes the last element of the anyOf.

Here is the schema I'm using:

"Payload": {
        "title": "Payload",
        "required": [
          "values"
        ],
        "type": "object",
        "properties": {
          "values": {
            "title": "Values",
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/VisualizationValue"
                    },
                    {
                      "$ref": "#/components/schemas/GroupValue"
                    },
                    ...(long union)
                  ]
                }
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Query"
                }
              }
            ]
          }
        }
      },

It will output the following type:

export type ParsePayload = {
    terms: Array<(Query)>;
};

What I would expect is:

export type ParsePayload = {
    terms: Array<VisualizationValue | GroupValue | ...> | Array<(Query)>;
};

Let me know if there are any other details I can add to help - thank you for all your work on this amazing project!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions