自动生成 WebApi 在线说明文档。
2021-05-31 15:04
标签:sch rop 状态码 put 方法 can body ogg example 1.使用Swashbuckle实现 Swashbuckle 是.NET类库,可以将WebAPI所有开放的控制器方法生成对应SwaggerUI的JSON配置。再通过SwaggerUI 显示出来。类库中已经包含SwaggerUI 。所以不需要额外安装。 2.快速开始。前提已有webapi项目 查看webapi项目属性,在【生成】选项卡中勾选X【ML文档文件】。在编译过程中会生成一个注释文件 自动生成 WebApi 在线说明文档。 标签:sch rop 状态码 put 方法 can body ogg example 原文地址:https://www.cnblogs.com/Jenny-1/p/11011117.html
///
‘use strict‘;
/**
* Translator for documentation pages.
*
* To enable translation you should include one of language-files in your index.html
* after .
* For example -
*
* If you wish to translate some new texsts you should do two things:
* 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too.
* 2. Mark that text it templates this way New Phrase or .
* The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate.
*
*/
window.SwaggerTranslator = {
_words: [],
translate: function () {
var $this = this;
$(‘[data-sw-translate]‘).each(function () {
$(this).html($this._tryTranslate($(this).html()));
$(this).val($this._tryTranslate($(this).val()));
$(this).attr(‘title‘, $this._tryTranslate($(this).attr(‘title‘)));
});
},
_tryTranslate: function (word) {
return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word;
},
learn: function (wordsMap) {
this._words = wordsMap;
},
setControllerSummary: function () {
$.ajax({
type: "get",
async: true,
url: $("#input_baseUrl").val(),
dataType: "json",
success: function (data) {
//console.log(data)
var toggleEndpointList = [];
var summaryDict = data.ControllerDesc;
var id, controllerName, strSummary;
var s = $("#resources .resource");
$("#resources .resource").each(function (i, item) {
id = $(item).attr("id");
if (id) {
controllerName = id.substring(9, 11) + "_" + id.substring(13);
strSummary = summaryDict[controllerName];
if (strSummary) {
console.log($(item))
$(item).children(".heading").children("h2").children(‘a‘).text(strSummary);
$(item).children(".heading").children(".options").prepend(‘
下一篇:C#主从表查询
文章标题:自动生成 WebApi 在线说明文档。
文章链接:http://soscw.com/index.php/essay/89778.html