BotSharp/BotSharp.WebHost/SwaggerFileUploadOperation.cs

31 lines
935 B
C#
Raw Normal View History

using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Collections.Generic;
2018-08-27 14:14:20 +00:00
using System.Linq;
using System.Text;
namespace BotSharp.WebHost
{
public class SwaggerFileUploadOperation : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
if (operation.OperationId == "V1AgentRestorePost")
{
operation.Parameters.Clear();
2018-08-27 14:14:20 +00:00
operation.Parameters.Add(new NonBodyParameter
{
Name = "uploadedFile",
In = "formData",
Description = "Upload Zip File meta.json is the extra data for customized function.",
Required = true,
Type = "file"
});
operation.Consumes.Add("multipart/form-data");
}
}
}
}