Skip to content

anyOf produces invalid output #305

@cozmo

Description

@cozmo

Given the following spec (which is valid/correct per https://www.jsonschemavalidator.net)

{
  "openapi": "3.0",
  "components": {
    "schemas": {
      "scalar_map": {
        "type": "object",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ]
        }
      }
    }
  }
}

swagger-to-ts outputs

/**
 * This file was auto-generated by swagger-to-ts.
 * Do not make direct changes to the file.
 */

export interface components {
  schemas: {
    scalar_map: { [key: string]: oneOf };
  };
}

which is malformed. The test case added in #201 works correctly, but it seems like maybe that's a unique/happy path? Seems like anyOf support still has some issues.

If you point me in the right direction I'd be happy to take a stab at fixing this, but at first pass not really sure where to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRs welcomePRs are welcome to solve this issue!bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions