protected virtual void UnauthorizedResponse(Operation operation, OperationFilterContext context)
        {
            var allowsAnonymous = ActionAttributes.OfType <AllowAnonymousAttribute>().Any();

            if (operation.Responses.ContainsKey("401"))
            {
                if (allowsAnonymous)
                {
                    operation.Responses.Remove("401");
                }
                else
                {
                    operation.Responses["401"].Description = "Unauthorized";
                }
                return;
            }
            ;

            if (!CombinedAttributes.OfType <AuthorizeAttribute>().Any() || allowsAnonymous)
            {
                return;
            }
            operation.Responses.Add("401", new Response
            {
                Description = "Unauthorized",
                Schema      = context.SchemaRegistry.GetOrRegister(typeof(Error))
            });
        }
        protected virtual void NoContentResponse(Operation operation, OperationFilterContext context)
        {
            if (!CombinedAttributes.OfType <HttpDeleteAttribute>().Any())
            {
                return;
            }
            operation.Responses.Remove("200");
            if (operation.Responses.ContainsKey("204"))
            {
                return;
            }

            operation.Responses.Add("204", new Response
            {
                Description = "Removed"
            });
        }
        protected virtual void BadRequestResponse(Operation operation, OperationFilterContext context)
        {
            if (operation.Responses.ContainsKey("400"))
            {
                return;
            }
            if (!CombinedAttributes.Any(x => x is ValidateModelStateAttribute || x is HttpPostAttribute || x is HttpPutAttribute || x is HttpPatchAttribute))
            {
                return;
            }

            operation.Responses.Add("400", new Response
            {
                Description = "Validation error",
                Schema      = context.SchemaRegistry.GetOrRegister(typeof(Error))
            });
        }
        protected virtual void CreatedResponse(Operation operation, OperationFilterContext context)
        {
            if (!CombinedAttributes.OfType <HttpPostAttribute>().Any())
            {
                return;
            }
            if (!operation.Responses.ContainsKey("201"))
            {
                return;
            }
            var response = operation.Responses["201"];

            if (response.Description.Equals("Success", StringComparison.CurrentCultureIgnoreCase))
            {
                response.Description = "Created";
            }
        }