Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Anže Vodovnik36a61c36b3dd
diff --git a/utils/doclint/generateDotnetApi.js b/utils/doclint/generateDotnetApi.js
index 2d25b22ae2..0575d03350 100644
--- a/utils/doclint/generateDotnetApi.js
+++ b/utils/doclint/generateDotnetApi.js
@@ -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;