public override Object Clone() { var cloneCopy = new OpenApiHeadersValidator(this._context); base.Copy(cloneCopy); return(cloneCopy); }
public override void AddRule(IValidate rule) { if (rule is OpenApiParameterRule) { var _openApiParameterRule = rule as OpenApiParameterRule; switch (_openApiParameterRule.InParameterLocation) { case ParameterLocation.Query: //Query = 0, if (_queryValidator == null) { _queryValidator = new OpenApiQueryStringValidator(_validatorContext); } _queryValidator.AddRule(_openApiParameterRule); break; case ParameterLocation.Header: //Header = 1, if (_headerValidator == null) { _headerValidator = new OpenApiHeadersValidator(_validatorContext); } _headerValidator.AddRule(_openApiParameterRule); break; case ParameterLocation.Path: //Path = 2, if (_pathValidator == null) { _pathValidator = new OpenApiPathValidator(_validatorContext); } _pathValidator.AddRule(_openApiParameterRule); break; case ParameterLocation.Cookie: //Cookie = 3 if (_cookiesValidator == null) { _cookiesValidator = new OpenApiCookiesValidator(_validatorContext); } _cookiesValidator.AddRule(_openApiParameterRule); break; case null: break; default: break; } } else if (rule is OpenApiBodyValidator) { _bodyValidator = rule as OpenApiBodyValidator; } }