Panda.DynamicWebApi icon indicating copy to clipboard operation
Panda.DynamicWebApi copied to clipboard

swagger生成错误

Open 771185858 opened this issue 2 years ago • 1 comments

产生原因:继承仓储服务

/// <summary>
/// 用户服务
/// </summary>
[ApiExplorerSettings(GroupName = "user")]
[DynamicWebApi]
public class UserService : BaseRepository<User>, IDynamicWebApi
{
    /// <summary>
    /// 添加用户
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task AddUser(UserRegisterRequestDto dto)
    {
        var user = new User()
        {
            Account = dto.Account,
            UserName = dto.UserName,
            Password = dto.Password,
        };
        await InsertAsync(user);
    }
}

public class BaseRepository<T> : SimpleClient<T> where T : class, new() { public BaseRepository(ISqlSugarClient? context = null) : base(context) { base.Context=context; } }

只要继承BaseRepository swagger就出不来了,难道只能构造注入一下?

771185858 avatar Aug 27 '22 08:08 771185858

改DynamicWebApiConvention源码,原因是读取了SqlSugar里的内容

771185858 avatar Sep 13 '22 06:09 771185858