-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Milestone
Description
Hi, all
I found some problems with Validation method.
For YAML:
definitions:
Parameter:
type: object
required:
- Value
- ArrayValue
properties:
Value:
type: integer
minimum: 3
maximum: 5
ArrayValue:
type: array
minItems: 3
maxItems: 5
items:
type: integer
Validation method:
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
// Value (int?) maximum
if(this.Value > (int?)5.0)
{
yield return new ValidationResult("Invalid value for Value, must be a value less than or equal to 5.0.", new [] { "Value" });
}
// Value (int?) minimum
if(this.Value < (int?)3.0)
{
yield return new ValidationResult("Invalid value for Value, must be a value greater than or equal to 3.0.", new [] { "Value" });
}
yield break;
}
There is no:
- Check properties for null (properties are required!)
- There is no
minItems,maxItemsvalidation !
PS: Our company use full PAID SwaggerHub subscription and we do not interested in using any branches or somethins else. Only stable Web SwaggerHub interface!