将小结使用草绘为路径添加摘要或供应商扩展名

问题描述 投票:2回答:1

根据openApi Spec

出于文档目的,路径可能具有可选的简短摘要和较长的描述。该信息应该与该路径中的所有操作有关。描述可以是多行,并支持Markdown(CommonMark)进行富文本表示。

我正在使用swashbuckle为我的API生成大张旗鼓的UI和文档。我需要为路径添加摘要和一些自定义字段。对于操作,我可以使用IOperationFilter进行添加,但是我找不到添加路径的任何方法。如何使用Swashbuckle添加?

c# swagger swashbuckle
1个回答
0
投票

无法在要链接的版本中添加summary,请参见型号PathItemhttps://github.com/domaindrivendev/Swashbuckle/blob/master/Swashbuckle.Core/Swagger/SwaggerDocument.cs#L75

public class PathItem
{
    [JsonProperty("$ref")]
    public string @ref;

    public Operation get;

    public Operation put;

    public Operation post;

    public Operation delete;

    public Operation options;

    public Operation head;

    public Operation patch;

    public IList<Parameter> parameters;

    public Dictionary<string, object> vendorExtensions = new Dictionary<string, object>();
}

您可以看到那里没有摘要...

我为您提供的唯一选择是分叉项目,然后将所需的内容添加到该模型中,我从头开始就走了同一条路:https://github.com/heldersepu/Swagger-Net我需要的许多功能都缺少了,就像您所建议的一样,如果您可以提供有关要实现的目标的更多详细信息,则可以在swagger-net上添加该功能

© www.soinside.com 2019 - 2024. All rights reserved.