-
-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
In v6.0.0 of MicroElements.Swashbuckle.FluentValidation, I get duplicated pattern rules in swagger.json:
"phone": {
"type": "string",
"allOf": [
{
"pattern": "^$|\\+(?:[0-9] ?){6,14}[0-9]"
},
{
"pattern": "^$|\\+(?:[0-9] ?){6,14}[0-9]"
},
{
"pattern": "^$|\\+(?:[0-9] ?){6,14}[0-9]"
}
],
"nullable": true
}whereas in v5.7.0 I only get one pattern as expected:
"phone": {
"pattern": "^$|\\+(?:[0-9] ?){6,14}[0-9]",
"type": "string",
"nullable": true
}
for a class ContactInfo that has a regex validation on Phone number.
This happens when I have multiple classes that uses the ContactInfo class by composition:
classDiagram
class ContactInfo {
+String Phone
}
class Teacher {
+ContactInfo ContactInfo
}
class Student {
+ContactInfo ContactInfo
}
Teacher --|> ContactInfo
Student --|> ContactInfo
Full sample
https://github.com/coder925/fluentvalidation-withregex
Consequence
The multiple patterns gives issues when generating TypeScript files for this swagger.json in openapi-generator-cli. The property phone will not be a string but an interface.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels