/// <summary> /// Generates typescript code for a given property /// </summary> /// <param name="property"></param> /// <param name="IsRouteParam"></param> private void ProcessClrProperty(PropertyInfo property, bool IsRouteParam = false) { PropertiesProcessed.Add(property.Name); // TODO: Add comments for ApiMember properties var docAttr = property.GetCustomAttribute <ApiMemberAttribute>(); Type returnType = property.GetMethod.ReturnType; // Optional parameters if (!IsRouteParam && (returnType.IsNullableType() || returnType.IsClass()) && (docAttr == null || !docAttr.IsRequired)) // Optional param. Could be string or a DTO type. { /*MethodParametersOptional.Add(property.Name.ToCamelCase() + "?: " + _CodeGenerator.DetermineTsType(returnType)); */ if (docAttr != null) { RouteInputPropertyLines.Add(EmitComment(docAttr)); } RouteInputPropertyLines.Add(property.Name + "?: " + _CodeGenerator.DetermineTsType(returnType, true) + ";"); } else // Required parameter { if (!IsRouteParam) { if (docAttr != null) { RouteInputPropertyLines.Add(EmitComment(docAttr)); } RouteInputHasOnlyOptionalParams = false; RouteInputPropertyLines.Add(property.Name + ": " + _CodeGenerator.DetermineTsType(returnType, true) + ";"); } else { MethodParameters.Add(property.Name.ToCamelCase() + ": " + _CodeGenerator.DetermineTsType(returnType, true)); } } ParamsWritten++; }