使用 swashbuckle 在 swagger 中向路径添加摘要或 vendorextensions
Add summary or vendorextensions to Paths in swagger using swashbuckle
Paths may have an optional short summary and a longer description for documentation purposes. This information is supposed to be relevant to all operations in this path. description can be multi-line and supports Markdown (CommonMark) for rich text representation.
我正在使用 swashbuckle 为我的 API 生成 swagger UI 和文档。我需要为路径添加摘要和一些自定义字段。对于我可以使用 IOperationFilter 添加的操作,但是我没有找到任何添加路径的方法。如何使用 Swashbuckle 添加?
无法将 summary
添加到您正在链接的版本中,请参阅模型 PathItem
:
https://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>();
}
如您所见,那里没有摘要...
我为您看到的唯一选择是分叉项目,然后将您需要的内容添加到该模型,
我从 swagger-net 走上了同一条路:
https://github.com/heldersepu/Swagger-Net
我需要的许多功能都缺少,就像您建议的那样,如果您可以提供有关您要实现的目标的更多详细信息,我可以在 swagger-net
上添加该功能
Paths may have an optional short summary and a longer description for documentation purposes. This information is supposed to be relevant to all operations in this path. description can be multi-line and supports Markdown (CommonMark) for rich text representation.
我正在使用 swashbuckle 为我的 API 生成 swagger UI 和文档。我需要为路径添加摘要和一些自定义字段。对于我可以使用 IOperationFilter 添加的操作,但是我没有找到任何添加路径的方法。如何使用 Swashbuckle 添加?
无法将 summary
添加到您正在链接的版本中,请参阅模型 PathItem
:
https://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>();
}
如您所见,那里没有摘要...
我为您看到的唯一选择是分叉项目,然后将您需要的内容添加到该模型,
我从 swagger-net 走上了同一条路:
https://github.com/heldersepu/Swagger-Net
我需要的许多功能都缺少,就像您建议的那样,如果您可以提供有关您要实现的目标的更多详细信息,我可以在 swagger-net