gpt4 book ai didi

swagger - 是否有 等效项

转载 作者:行者123 更新时间:2023-12-03 14:08:48 24 4
gpt4 key购买 nike

我更新了 Swashbuckle v5 并且 operation.Parameters() 不再有效。是否有替代品?

        {
var apiDescription = context.ApiDescription;

operation.Deprecated |= apiDescription.IsDeprecated();

if (operation.Parameters == null)
{
return;
}

// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/412
// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/413
foreach (var parameter in operation.Parameters<NonBodyParameter>())
{

var description = apiDescription.ParameterDescriptions.First(p => p.Name == parameter.Name);

if (parameter.Description == null)
{
parameter.Description = description.ModelMetadata?.Description;
}

if (parameter.Default == null)
{
parameter.Default = description.DefaultValue;
}

parameter.Required |= description.IsRequired;
}
}

错误 CS0307 属性“OpenApiOperation.Parameters”不能与类型参数一起使用

最佳答案

来自 Swashbuckle.AspNetCore GitHub site

In OpenAPI v3, body parameters are split out into a separate property called RequestBody. So, I think you may be able to remove OfType filter entirely as all values in the collection are "non-body"



我认为你应该可以使用 OpenApiParameter .

关于swagger - 是否有 <NonBodyParameter> 等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58801411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com