Incorrect "string | string" type generated from the swagger.json using oneOf statement
8Duke8 opened this issue · comments
Here is a part of the schema: The oneOf condition for phone property below incorrectly generates the type "string | string" as shown in result below (even in the latest version 8.0.0).
SOURCE:
"/users/{userId}": {
"put": {
"operationId": "putUserAsAdmin",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"phone": {
"oneOf": [
{
"type": "string",
"pattern": "^(\\([0-9]{3}\\) ?|[0-9]{3}-)?[0-9]{3}-[0-9]{4}$|^\\d{10}$"
},
{
"type": "string",
"minLength": 0,
"maxLength": 0
}
]**
},
"name": {
"type": "string"
},
"email": {
"type": "string",
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
},
...
RESULT:
export type PutUserAsAdminRequestBody = {
phone?: string | string;
name: string;
/**
* @pattern ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
*/
email: string;
...
};