C# Class Swashbuckle.Annotations.SwagValidator

Validates the attribute tag validations declared on the class
Show file Open project: BenjaminAdams/Swashbuckle-blue

Public Methods

Method Description
TryValidate ( object input, string &errorMessage, bool outputJsonPayload = false ) : bool

Validates the attribute tag validations declared on the class. Returns false if validation rules are not met and returns the error message in the errorMessage (out) parameter

Validate ( object input, bool outputJsonPayload = false ) : bool

Validates the attribute tag validations declared on the class. Throws an ValidationException if any validation rules are not met

Private Methods

Method Description
CheckDefinedExAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void

Checks the Defined attribute.

CheckList ( object input, bool outputJsonPayload = false ) : bool
CheckListProperty ( object input, PropertyInfo prp, bool outputJsonPayload = false ) : void
CheckMaxLengthAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void
CheckMinLengthAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void
CheckRangeAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void
CheckRegularExpressionAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void

Checks the Defined attribute.

CheckRequiredAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void
CheckStringLengthAttribute ( PropertyInfo property, object input, bool outputJsonPayload ) : void
IsPrimitiveType ( object myObject ) : bool
ObjReqChecker ( object input, PropertyInfo prp, bool outputJsonPayload = false ) : void

Method Details

TryValidate() public static method

Validates the attribute tag validations declared on the class. Returns false if validation rules are not met and returns the error message in the errorMessage (out) parameter
public static TryValidate ( object input, string &errorMessage, bool outputJsonPayload = false ) : bool
input object The object you wish to validate
errorMessage string The error message
outputJsonPayload bool If you want the error message to contain the values in the object we are validating
return bool

Validate() public static method

Validates the attribute tag validations declared on the class. Throws an ValidationException if any validation rules are not met
public static Validate ( object input, bool outputJsonPayload = false ) : bool
input object The object you wish to validate
outputJsonPayload bool If true will output the contents of input payload in the exception
return bool