json2jsii icon indicating copy to clipboard operation
json2jsii copied to clipboard

Duplicate static `from*` helper methods are produced

Open moltar opened this issue 2 years ago • 0 comments

Given the following snippet from a JSON Schema:

{
    "shell": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "string",
          "enum": ["bash", "pwsh", "python", "sh", "cmd", "powershell"]
        }
      ]
    }
}

Will produce invalid code, where fromString is duplicated:

export class Shell {
  public static fromString(value: string): Shell {
    return new Shell(value);
  }
  public static fromString(value: string): Shell {
    return new Shell(value);
  }
  private constructor(public readonly value: string | string) {
  }
}

moltar avatar Jul 15 '23 19:07 moltar