Remove display of optional type identifiers.
@@ -436,6 +436,10 @@ func (mod *modContext) typeString(t schema.Type, lang string, characteristics pr
}
displayName = wbr(displayName)
}
+
+ displayName = cleanOptionalIdentifier(displayName, lang)
+ langTypeString = cleanOptionalIdentifier(langTypeString, lang)
+
return propertyType{
Name: langTypeString,
DisplayName: displayName,
@@ -443,6 +447,21 @@ func (mod *modContext) typeString(t schema.Type, lang string, characteristics pr
}
}
+// cleanOptionalIdentifier removes the type identifier (i.e. "?" in "string?").
+func cleanOptionalIdentifier(s, lang string) string {
+ switch lang {
+ case "nodejs":
+ return strings.TrimSuffix(s, "?")
+ case "go":
+ return strings.TrimPrefix(s, "*")
+ case "csharp":
+ return strings.TrimSuffix(s, "?")
+ case "python":
+ return s
+ }
+ return s
+}
+
func (mod *modContext) genConstructorTS(r *schema.Resource, argsOptional bool) []formalParam {
name := resourceName(r)
docLangHelper := getLanguageDocHelper("nodejs")
