BotSharp/BotSharp.WebHost/SwaggerFileUploadOperation.cs
2018-10-02 20:44:11 -05:00

31 lines
934 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BotSharp.WebHost
{
public class SwaggerFileUploadOperation : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
if (operation.OperationId == "V1AgentImportPost")
{
operation.Parameters.Clear();
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");
}
}
}
}