Bumped package version to 1.9.2. Added default value documentation to function parameters for Javascript to help fix VSCode not displaying them when hovering.

This commit is contained in:
2025-10-12 19:15:15 -07:00
parent 528c841828
commit 49c24ca39f
2 changed files with 13 additions and 9 deletions

View File

@@ -17,7 +17,7 @@
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>1.9.1</Version>
<Version>1.9.2</Version>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>

View File

@@ -81,8 +81,8 @@ namespace MontoyaTech.Rest.Net
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Initializes this api client with a given baseUrl of where to send requests.");
writer.WriteLine("@param {string} baseUrl Base url of the server to make requests against.");
writer.WriteLine("@param {Function} urlHandler An optional function to process request urls before they are sent. This must return the url.");
writer.WriteLine("@param {Function} requestHandler An optional function to process requests before they are sent. This must return the request.");
writer.WriteLine("@param {Function} urlHandler An optional function to process request urls before they are sent. This must return the url. Default is null.");
writer.WriteLine("@param {Function} requestHandler An optional function to process requests before they are sent. This must return the request. Default is null.");
writer.Outdent().WriteLine("*/");
if (this.NamedParameters)
writer.Write("static Init({ baseUrl, urlHandler = null, requestHandler = null } = {}) ");
@@ -116,8 +116,8 @@ namespace MontoyaTech.Rest.Net
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Initializes this api client with a given baseUrl of where to send requests.");
writer.WriteLine("@param {string} baseUrl Base url of the server to make requests against.");
writer.WriteLine("@param {Function} urlHandler An optional function to process request urls before they are sent. This must return the url.");
writer.WriteLine("@param {Function} requestHandler An optional function to process requests before they are sent. This must return the request.");
writer.WriteLine("@param {Function} urlHandler An optional function to process request urls before they are sent. This must return the url. Default is null.");
writer.WriteLine("@param {Function} requestHandler An optional function to process requests before they are sent. This must return the request. Default is null.");
writer.Outdent().WriteLine("*/");
if (this.NamedParameters)
writer.Write("constructor({ baseUrl, urlHandler = null, requestHandler = null } = {}) ");
@@ -370,18 +370,22 @@ namespace MontoyaTech.Rest.Net
foreach (var field in fields)
{
if (this.UseJsonNames)
writer.WriteLine($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {EscapeName(field.GetCustomAttribute<Newtonsoft.Json.JsonPropertyAttribute>()?.PropertyName ?? field.Name)}");
writer.Write($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {EscapeName(field.GetCustomAttribute<Newtonsoft.Json.JsonPropertyAttribute>()?.PropertyName ?? field.Name)}");
else
writer.WriteLine($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {EscapeName(field.Name)}");
writer.Write($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {EscapeName(field.Name)}");
writer.WriteSpacer().Write("Default is ").Write(this.GetTypeDefaultValue(field.FieldType)).WriteLine('.');
}
//Document the properties
foreach (var property in properties)
{
if (this.UseJsonNames)
writer.WriteLine($"@param {{{this.GetTypeFullyResolvedName(property.PropertyType)}}} {EscapeName(property.GetCustomAttribute<Newtonsoft.Json.JsonPropertyAttribute>()?.PropertyName ?? property.Name)}");
writer.Write($"@param {{{this.GetTypeFullyResolvedName(property.PropertyType)}}} {EscapeName(property.GetCustomAttribute<Newtonsoft.Json.JsonPropertyAttribute>()?.PropertyName ?? property.Name)}");
else
writer.WriteLine($"@param {{{this.GetTypeFullyResolvedName(property.PropertyType)}}} {EscapeName(property.Name)}");
writer.Write($"@param {{{this.GetTypeFullyResolvedName(property.PropertyType)}}} {EscapeName(property.Name)}");
writer.WriteSpacer().Write("Default is ").Write(this.GetTypeDefaultValue(property.PropertyType)).WriteLine('.');
}
writer.Outdent().WriteLine("*/");