我有这个 API
public ActionResult AddDocument([FromBody]AddDocumentRequestModel documentRequestModel)
{
AddDocumentStatus documentState = _documentService.AddDocument(documentRequestModel, DocumentType.OutgoingPosShipment);
if (documentState.IsSuccess)
return Ok();
return BadRequest();
}
Run Code Online (Sandbox Code Playgroud)
这是我的请求模型
public class AddDocumentRequestModel
{
public AddDocumentRequestModel(int partnerId, List<ProductRequestModel> products)
{
PartnerId = partnerId;
Products = products;
}
[Range(1, int.MaxValue, ErrorMessage = "Value for {0} must be between {1} and {2}.")]
public int PartnerId { get; private set; }
[Required, MustHaveOneElement(ErrorMessage = "At least one product is required")]
public List<ProductRequestModel> Products { get; private set; }
}
Run Code Online (Sandbox Code Playgroud)
所以当我试图用这个身体点击 API 时
{ …Run Code Online (Sandbox Code Playgroud) 我更新了 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;
}
}
Run Code Online (Sandbox Code Playgroud)
错误 CS0307 属性“OpenApiOperation.Parameters”不能与类型参数一起使用
我读了很多关于 Lucene 索引和搜索的内容,但仍然不明白 Term 是什么?term 和 fields 之间有什么区别?