mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
docs: api root, buildinfo, csp (#5493)
* docs: Applications * WIP * WIP * WIP * Fix: consume * Fix: @Description * Fix * docs: apiroot, buildinfo, csp * Fix: buildinfo * docs: updatecheck * docs: apiroot * Fix: s/none//g * Fix: godoc nice * Fix: description * Fix: It * Fix: code sample trim empty line * More fixes * Fix: br * Merge * Fix: no-security on updatecheck * Fix: code tags * Fix: enumerated values in code tags * Rephrased * Address PR comments * Fix: URL, id * Fix: array items * Fix: any property * Fix: array item singular
This commit is contained in:
@ -28,12 +28,27 @@
|
||||
return "`" + p.displayName + "`";
|
||||
}
|
||||
|
||||
function correctLetterCase(description) {
|
||||
const dictionary = ["id", "url"];
|
||||
|
||||
const words = description.split(' ');
|
||||
var corrected = [];
|
||||
words.forEach(word => {
|
||||
if (dictionary.includes(word.toLowerCase())) {
|
||||
corrected.push(word.toUpperCase());
|
||||
return;
|
||||
}
|
||||
corrected.push(word);
|
||||
});
|
||||
return corrected.join(" ");
|
||||
}
|
||||
|
||||
function renderDescription(p) {
|
||||
if (!p.description) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const description = p.description.replaceAll("<br><br>", "\n").replaceAll("<br>", " ");
|
||||
let description = p.description.replaceAll("<br><br>", "\n").replaceAll("<br>", " ");
|
||||
const words = description.split(' ');
|
||||
if (words.length == 0) {
|
||||
return "";
|
||||
@ -43,9 +58,9 @@
|
||||
if (countUppercase > 1) {
|
||||
let displayName = p.displayName.replaceAll("» **additionalProperties**", "It");
|
||||
displayName = displayName.charAt(0).toUpperCase() + displayName.replaceAll("_", " ").toLowerCase().slice(1);
|
||||
return displayName + " " + words.slice(1).join(' ');
|
||||
description = displayName + " " + words.slice(1).join(' ');
|
||||
}
|
||||
return description;
|
||||
return correctLetterCase(description);
|
||||
}
|
||||
}}
|
||||
|
||||
@ -140,7 +155,7 @@
|
||||
|
||||
|Property|Value|
|
||||
|---|---|
|
||||
{{~ enums :e}}|{{=e.name}}|{{=data.utils.toPrimitive(e.value)}}|
|
||||
{{~ enums :e}}|`{{=e.name}}`|`{{=data.utils.toPrimitive(e.value)}}`|
|
||||
{{~}}
|
||||
|
||||
{{= data.tags.endSection }}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
|Name|In|Type|Required|Description|
|
||||
|---|---|---|---|---|
|
||||
{{~ data.parameters :p}}|{{=p.name}}|{{=p.in}}|{{= renderParameterType(p)}}|{{=p.required}}|{{=p.shortDesc||''}}|
|
||||
{{~ data.parameters :p}}|`{{=p.name}}`|{{=p.in}}|{{= renderParameterType(p)}}|{{=p.required}}|{{=p.shortDesc||''}}|
|
||||
{{~}}
|
||||
|
||||
{{? data.longDescs }}
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
|Parameter|Value|
|
||||
|---|---|
|
||||
{{~ data.enums :e}}|{{=e.name}}|{{=data.utils.toPrimitive(e.value)}}|
|
||||
{{~ data.enums :e}}|`{{=e.name}}`|`{{=data.utils.toPrimitive(e.value)}}`|
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{= data.tags.endSection }}
|
||||
|
@ -24,6 +24,14 @@
|
||||
}
|
||||
return renderSingleResponseType(r);
|
||||
}
|
||||
|
||||
function renderDisplayName(p) {
|
||||
if (p.displayName == "*anonymous*") {
|
||||
return "[array item]";
|
||||
}
|
||||
let displayName = p.displayName.replace("**additionalProperties**", "[any property]");
|
||||
return displayName;
|
||||
}
|
||||
}}
|
||||
{{ data.responses = data.utils.getResponses(data); }}
|
||||
{{ data.responseSchemas = false; }}
|
||||
@ -77,7 +85,7 @@ Status Code **{{=response.status}}**
|
||||
{{?}}
|
||||
|Name|Type|Required|Restrictions|Description|
|
||||
|---|---|---|---|---|
|
||||
{{~block.rows :p}}|{{=p.displayName}}|{{? p.$ref}}`{{=p.$ref}}`{{?}}{{? !p.$ref}}{{=p.type}}{{?}}|{{=p.required}}|{{=p.restrictions||''}}|{{=p.description||''}}|
|
||||
{{~block.rows :p}}|`{{=renderDisplayName(p)}}`|{{? p.$ref}}`{{=p.$ref}}`{{?}}{{? !p.$ref}}{{=p.type}}{{?}}|{{=p.required}}|{{=p.restrictions||''}}|{{=p.description||''}}|
|
||||
{{~}}
|
||||
{{~}}
|
||||
{{?}}
|
||||
@ -87,7 +95,7 @@ Status Code **{{=response.status}}**
|
||||
|
||||
|Property|Value|
|
||||
|---|---|
|
||||
{{~ enums :e}}|{{=e.name}}|{{=data.utils.toPrimitive(e.value)}}|
|
||||
{{~ enums :e}}|`{{=e.name}}`|`{{=data.utils.toPrimitive(e.value)}}`|
|
||||
{{~}}
|
||||
|
||||
{{?}}
|
||||
|
Reference in New Issue
Block a user