Skip to content

bug: multiple oneOf cases for a key are not handled properly #290

@Spence1115

Description

@Spence1115

When a schema produces multiple oneOf statements for a key, we are nesting them when we should be combining them

Example

        {
          "form": [
            {
              "value": "John Doe",
            },
            {
              "value": [],
            },
            {
              "value": null,
            },
          ]
        },
        {
          "form": null
        },
        {
          "form": [
            {
              "value": false,
            },
            {
              "value": ["First", "Second"],
            },
            {
              "value": 3,
            },
          ]
        }

Expected

                              value:
                                oneOf:
                                - type: string
                                - type: array
                                  items: {}
                                - type: boolean
                                - type: array
                                  items:
                                    type: string
                                - type: integer

Actual

                              value:
                                oneOf:
                                - oneOf:
                                  - type: string
                                  - type: array
                                    items: {}
                                - oneOf:
                                  - type: boolean
                                  - type: array
                                    items:
                                      type: string
                                  - type: integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions