docs(dotnet): ability to generate generics and null on path args (#5824)

This commit is contained in:
Anže Vodovnik 2021-03-16 17:19:30 +01:00 committed by GitHub
parent ab4629af38
commit 36a61c36b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -469,8 +469,8 @@ function renderMethod(member, parent, output, name) {
if (arg.type.expression === '[string]|[path]') {
let argName = translateMemberName('argument', arg.name, null);
pushArg("string", argName, arg);
pushArg("string", `${argName}Path`, arg);
pushArg("string", `${argName} = null`, arg);
pushArg("string", `${argName}Path = null`, arg);
if (arg.spec) {
addParamsDoc(argName, XmlDoc.renderTextOnly(arg.spec, maxDocumentationColumnWidth));
addParamsDoc(`${argName}Path`, [`Instead of specifying <paramref name="${argName}"/>, gives the file name to load from.`]);
@ -691,6 +691,13 @@ function translateType(type, parent, generateNameCallback = t => t.name) {
}
}
if (type.templates) {
// this should mean we have a generic type and we can translate that
/** @type {string[]} */
var types = type.templates.map(template => translateType(template, parent));
return `${type.name}<${types.join(', ')}>`
}
// there's a chance this is a name we've already seen before, so check
// this is also where we map known types, like boolean -> bool, etc.
let name = classNameMap.get(type.name) || type.name;