cdklabs / cdklabs/json2jsii

Duplicate static `from*` helper methods are produced

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub
p2
Dominant language
TypeScript
Stars
24
Forks
14
Avg merge
22m
Merged PRs (30d)
4

Description

Given the following snippet from a JSON Schema:

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

Will produce invalid code, where `fromString` is duplicated:

```ts
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) {
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.