Fixed a stackoverflow bug when generating a Rest Client and the object has it's type as a sub type. Bumped package versino to 1.7.5
This commit is contained in:
		@@ -8,6 +8,7 @@ using System.IO;
 | 
				
			|||||||
using MontoyaTech.Rest.Net;
 | 
					using MontoyaTech.Rest.Net;
 | 
				
			||||||
using System.Net.Mime;
 | 
					using System.Net.Mime;
 | 
				
			||||||
using System.Collections;
 | 
					using System.Collections;
 | 
				
			||||||
 | 
					using Newtonsoft.Json.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MontoyaTech.Rest.Net.Example
 | 
					namespace MontoyaTech.Rest.Net.Example
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -80,6 +81,7 @@ namespace MontoyaTech.Rest.Net.Example
 | 
				
			|||||||
                new Route<string>(HttpRequestMethod.Get, "/auth/{username}", Exists),
 | 
					                new Route<string>(HttpRequestMethod.Get, "/auth/{username}", Exists),
 | 
				
			||||||
                new Route(HttpRequestMethod.Post, "/auth/signup", Signup),
 | 
					                new Route(HttpRequestMethod.Post, "/auth/signup", Signup),
 | 
				
			||||||
                new Route(HttpRequestMethod.Get, "/auth/", Json),
 | 
					                new Route(HttpRequestMethod.Get, "/auth/", Json),
 | 
				
			||||||
 | 
					                new Route(HttpRequestMethod.Get, "/auth/dynamic", Dynamic),
 | 
				
			||||||
                new Route(HttpRequestMethod.Get, "/auth/role", GetRole),
 | 
					                new Route(HttpRequestMethod.Get, "/auth/role", GetRole),
 | 
				
			||||||
                new Route(HttpRequestMethod.Post, "/upload", Upload),
 | 
					                new Route(HttpRequestMethod.Post, "/upload", Upload),
 | 
				
			||||||
                new Route(HttpRequestMethod.Get, "/download", Download),
 | 
					                new Route(HttpRequestMethod.Get, "/download", Download),
 | 
				
			||||||
@@ -208,6 +210,13 @@ namespace MontoyaTech.Rest.Net.Example
 | 
				
			|||||||
            return context.Response.WithStatus(HttpStatusCode.OK).WithJson(new User("Rest.Net"));
 | 
					            return context.Response.WithStatus(HttpStatusCode.OK).WithJson(new User("Rest.Net"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [RouteGroup("Auth")]
 | 
				
			||||||
 | 
					        [RouteResponse(typeof(JObject))]
 | 
				
			||||||
 | 
					        public static HttpListenerResponse Dynamic(HttpListenerContext context)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return context.Response.WithStatus(HttpStatusCode.OK).WithJson(777);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [RouteGroup("Stream")]
 | 
					        [RouteGroup("Stream")]
 | 
				
			||||||
        [RouteRequest(typeof(MemoryStream))]
 | 
					        [RouteRequest(typeof(MemoryStream))]
 | 
				
			||||||
        public static HttpListenerResponse Upload(HttpListenerContext context)
 | 
					        public static HttpListenerResponse Upload(HttpListenerContext context)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@
 | 
				
			|||||||
    <AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
 | 
					    <AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
 | 
				
			||||||
    <RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
 | 
					    <RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
 | 
				
			||||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
					    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
				
			||||||
    <Version>1.7.4</Version>
 | 
					    <Version>1.7.5</Version>
 | 
				
			||||||
    <PackageReleaseNotes></PackageReleaseNotes>
 | 
					    <PackageReleaseNotes></PackageReleaseNotes>
 | 
				
			||||||
    <PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
 | 
					    <PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.ComponentModel.DataAnnotations;
 | 
					using System.ComponentModel.DataAnnotations;
 | 
				
			||||||
using System.ComponentModel.Design;
 | 
					using System.ComponentModel.Design;
 | 
				
			||||||
@@ -69,11 +69,14 @@ namespace MontoyaTech.Rest.Net
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                foreach (var argument in arguments)
 | 
					                foreach (var argument in arguments)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    var types = this.FindTypeDependencies(argument);
 | 
					                    if (argument != type)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        var types = this.FindTypeDependencies(argument);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    for (int i = 0; i < types.Count; i++)
 | 
					                        for (int i = 0; i < types.Count; i++)
 | 
				
			||||||
                        if (!dependencies.Contains(types[i]))
 | 
					                            if (!dependencies.Contains(types[i]))
 | 
				
			||||||
                            dependencies.Add(types[i]);
 | 
					                                dependencies.Add(types[i]);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,7 +102,7 @@ namespace MontoyaTech.Rest.Net
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                foreach (var field in fields)
 | 
					                foreach (var field in fields)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (field.IsPublic && !field.IsSpecialName)
 | 
					                    if (field.IsPublic && !field.IsSpecialName && field.FieldType != type)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        var types = this.FindTypeDependencies(field.FieldType);
 | 
					                        var types = this.FindTypeDependencies(field.FieldType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -116,7 +119,7 @@ namespace MontoyaTech.Rest.Net
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                foreach (var property in properties)
 | 
					                foreach (var property in properties)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (!property.IsSpecialName && property.GetSetMethod() != null && property.GetGetMethod() != null)
 | 
					                    if (!property.IsSpecialName && property.GetSetMethod() != null && property.GetGetMethod() != null && property.PropertyType != type)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        var types = this.FindTypeDependencies(property.PropertyType);
 | 
					                        var types = this.FindTypeDependencies(property.PropertyType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user