Bumped package version to 1.8.2. Added the ability to use json names in the Javascript Client generator if a JsonProperty exists on a field or a property.
This commit is contained in:
@ -11,17 +11,22 @@ using System.Collections;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Web;
|
||||
using System.Net.Http;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MontoyaTech.Rest.Net.Example
|
||||
{
|
||||
public class BaseUser
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public string Id;
|
||||
|
||||
[JsonProperty("firstInitial")]
|
||||
public char FirstInitial;
|
||||
|
||||
[JsonProperty("role")]
|
||||
public UserRole Role { get; set; }
|
||||
|
||||
[JsonProperty("permissions")]
|
||||
public List<Permission> Permissions;
|
||||
|
||||
public class Permission
|
||||
@ -94,11 +99,11 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
|
||||
File.WriteAllText("Client.cs", listener.GenerateCSharpClient());
|
||||
|
||||
File.WriteAllText("Client.js", listener.GenerateJavascriptClient());
|
||||
File.WriteAllText("Client.js", listener.GenerateJavascriptClient(useJsonNames: true));
|
||||
|
||||
File.WriteAllText("StaticClient.cs", listener.GenerateCSharpClient("StaticClient", staticCode: true));
|
||||
|
||||
File.WriteAllText("StaticClient.js", listener.GenerateJavascriptClient("StaticClient", staticCode: true));
|
||||
File.WriteAllText("StaticClient.js", listener.GenerateJavascriptClient("StaticClient", staticCode: true, useJsonNames: true));
|
||||
|
||||
Console.WriteLine("Generated Client.cs, Client.js, StaticClient.cs, StaticClient.js");
|
||||
|
||||
|
Reference in New Issue
Block a user