public void Apply(Operation operation, OperationFilterContext context)
        {
            // Register DynamicException
            var name = nameof(ErrorResponse);

            if (!context.SchemaRegistry.Definitions.ContainsKey(name))
            {
                context.SchemaRegistry.GetOrRegister(typeof(ErrorResponse));
            }

            // Register the new default 500 behaviour
            if (!operation.Responses.ContainsKey(Status500InternalServerError))
            {
                var response = new Response
                {
                    Description = "Internal Server Error",
                    Schema      = new Schema
                    {
                        Ref = $"#/definitions/{nameof(ErrorResponse)}",
                    },
                    Examples = ExamplesFactory.CreateDynamicException()
                };
                operation.Responses.Add(Status500InternalServerError, response);
            }
        }
 public void Apply(Operation operation, OperationFilterContext context)
 {
     // Override the default 400 behaviour to action that define it, with specifying a type.
     if (operation.Responses.ContainsKey(Status400BadRequest))
     {
         var badRequestResponse = operation.Responses.FirstOrDefault(x => x.Key == Status400BadRequest);
         if (badRequestResponse.Value.Schema == null)
         {
             badRequestResponse.Value.Description = "Bad Request";
             badRequestResponse.Value.Schema      = new Schema
             {
                 Ref = $"#/definitions/{nameof(ErrorResponse)}",
             };
             badRequestResponse.Value.Examples = ExamplesFactory.CreateDynamicValidation();
         }
     }
 }