public void Apply(Operation operation, Dictionary<string, DataType> complexModels, DataTypeGenerator dataTypeGenerator, ApiDescription apiDescription)
 {
     if (apiDescription.ActionDescriptor.GetFilters().OfType<AuthorizeAttribute>().Any())
     {
         operation.ResponseMessages.Add(new ResponseMessage
         {
             Code = (int)HttpStatusCode.Unauthorized,
             Message = "Authentication required"
         });
     }
 }
Пример #2
0
        public void Apply(Operation operation, Dictionary<string, DataType> complexModels, DataTypeGenerator dataTypeGenerator, ApiDescription apiDescription)
        {
            operation.ResponseMessages.Add(new ResponseMessage
            {
                Code = (int)HttpStatusCode.OK,
                Message = "It's all good!"
            });

            operation.ResponseMessages.Add(new ResponseMessage
            {
                Code = (int)HttpStatusCode.InternalServerError,
                Message = "Somethings up!"
            });
        }