From 49c24ca39ff2d2559b0a71beb65db0b456552096 Mon Sep 17 00:00:00 2001 From: MattMo Date: Sun, 12 Oct 2025 19:15:15 -0700 Subject: [PATCH] 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. --- Rest.Net/Rest.Net.csproj | 2 +- Rest.Net/RestJavascriptClientGenerator.cs | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index 3c33dd9..15d02b1 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.9.1 + 1.9.2 Logo_Symbol_Black_Outline.png README.md diff --git a/Rest.Net/RestJavascriptClientGenerator.cs b/Rest.Net/RestJavascriptClientGenerator.cs index 344f40e..3256d89 100644 --- a/Rest.Net/RestJavascriptClientGenerator.cs +++ b/Rest.Net/RestJavascriptClientGenerator.cs @@ -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()?.PropertyName ?? field.Name)}"); + writer.Write($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {EscapeName(field.GetCustomAttribute()?.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()?.PropertyName ?? property.Name)}"); + writer.Write($"@param {{{this.GetTypeFullyResolvedName(property.PropertyType)}}} {EscapeName(property.GetCustomAttribute()?.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("*/");