Giter Club home page Giter Club logo

webapiproxy's People

Contributors

alexdovgan avatar chrissainty avatar damovisa avatar faniereynders avatar giacomelli avatar gitter-badger avatar harindaka avatar lust4life avatar nillis avatar onionhammer avatar pecord avatar travisrussi avatar wocar avatar wolfen351 avatar xps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webapiproxy's Issues

Install WebApiProxy via VSIX

OK, you got my motor running on this project. :)

I am thinking it would be cool to create a VSIX that is used to create proxies exactly how they were done in WCF. Essentially you can register proxies via the solution or you can register them via a URL. I would also like to introduce a configuration mechanism that I believe I mentioned in another issue #24. The challenge here is that it should be PCL and work across multiple client platforms, something I would be interested in doing. Also, since this would allow multiple registrations, this should address issue #10 as well.

Another advantage with using VSIX and commands is that you sidestep using MSBuild commands and infrastructure, which is clumsy and error-prone (not to mention it is greedy with resources which locks them unnecessarily, causing all sorts of headaches which I'm sure you've experienced).

Finally, I would also like to create dialog options that allow the user to specify the generation of sync/async methods, which would attend to issue #23. And while I am at it, I will see if I can fix #16 as well.

This should take me a few weeks, but if it is OK I would like to start working on this and provide you a PR once I am done. :)

js proxy does not ignore parameters covered by an `IModelBinder`

I use IModelBinder to supply default arguments to my controller actions for things like "current logged in user", so my controller action looks like:

public SaveResult Save(SaveRequest req, IUser currentUser){
  return DB.save(res, currentUser);
};

with the model binder filling in the correct value for currentUser.

The JS proxy generated for Save should ignore the IUser parameter, since it will be bound automatically by WebApi.

http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api

Bug: NullReferenceException when calling api/proxies

If I make a request to http://localhost:54539/api/proxies it throws the following exception:

{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at WebApiProxy.Server.MetadataProvider.<>c__DisplayClass10.b__d(ApiParameterDescription b)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Enumerable.d__711.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at WebApiProxy.Server.Templates.JsProxyTemplate.TransformText()\r\n at WebApiProxy.Server.ProxyHandler.<>c__DisplayClass3.b__1()\r\n at System.Threading.Tasks.Task1.InnerInvoke()\r\n at System.Threading.Tasks.Task.Execute()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at WebApiProxy.Server.ProxyHandler.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.HttpServer.d__0.MoveNext()","ErrorID":null}

Attribute based routing

Does the WebApiProxy.Server work with attribute routing in Web API 2?

I am trying to use it and get this error:

{
"Message":"An error has occurred.",
"ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
"ExceptionType":"System.InvalidOperationException",
"StackTrace":null,
"InnerException":{
    "Message":"An error has occurred.",
    "ExceptionMessage":"Collection was modified; enumeration operation may not execute.",
    "ExceptionType":"System.InvalidOperationException",
    "StackTrace":"   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()\r\n   at System.Collections.Generic.List`1.Enumerator.MoveNext()\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__14.MoveNext()"
    }
}

Extending BaseClient

Hi there,
This is an amazingly useful piece of work. Well done!

I want to be able to add headers to the ClientBase HttpClient DefaultRequestHeaders automatically.

I can see that ClientBase is partial so I can add my own methods etc. to it but I cannot see any way to add to it such that it would be able to always ensure that headers were added 'automagically'

Is there a good way to do this?

If not would it be appropriate to add some extensibility to ClientBase e.g. adding

class ClientBase : ClientBaseBase {
    ClientBase() {
        HttpClient = new HttpClient(){ ... }
        Initialize()    
    }
}


class ClientBaseBase {
     protected void Initialize() {
          //Override this to extend Clients
     }
}

I'm happy to make a PR for this or similar if you think it's appropriate?

very weird issue

Hi, Below is my code. For some reason, if I add a third method (in this case GetDataSources), it messes things with the proxy generation. Proxy class is generated with only GetReportClassType method. If I remove GetDataSources, then the proxy gets generated with both the methods. Have you seen this issue? Please let me know if I am missing anything. Thanks Karthik

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using CommonDbInfrastructure;

namespace CommonDbWebApi.Controllers
{
    public class ReportController : ApiController
    {

        [System.Web.Http.HttpGet]
        public IHttpActionResult GetReportClassTypes()
        {
            try
            {
                using (var manager = CreateReportDataManager())
                {
                    var result = manager.GetReportClassTypes();
                    return Ok(result.ToList());
                }
            }
            catch (Exception ex)
            {
                return InternalServerError(ex);
            }
        }
        // Get values for a class type.
        [System.Web.Http.HttpGet]
        public IHttpActionResult GetReportClassType(int classTypeId)
        {
            try
            {
                using (var manager = CreateReportDataManager())
                {
                    var result = manager.GetReportClassType(classTypeId);
                    return Ok(result);
                }
            }
            catch (Exception e)
            {

                return InternalServerError(e);
            }
        }
        // Get values for a class type.
        [System.Web.Http.HttpGet]
        public IHttpActionResult GetDataSources(IEnumerable<int> dataSourceIds)
        {
            try
            {
                using (var manager = CreateReportDataManager())
                {
                    var result = manager.GetReportDataSources(dataSourceIds);
                    return Ok(result);
                }
            }
            catch (Exception e)
            {

                return InternalServerError(e);
            }
        }

    }
}

Synchronous Calls?

Hello,

Once again, I would like to express my total appreciation for this project! Very happy to see someone put this together (and even more surprised that it's not a first-class component to the MVC framework).

It appears that this project currently produces asynchronous operations. Which is great if you are not managing async/tasks within your application. However, some of us have components that do manage this for us (and are also, um, apprehensive, towards async to begin with... beware of zombies. :)) and prefer synchronous calls. It would be great if this project supported them. I would be interested in making this happen with a pull request if that would help.

If this is an easy existing setting that I am overlooking that would be great to know, too.

Thank you,
Michael

WebApiProxy.CSharp doesn't generate interfaces

Hi

Thanks for all the hard work!

One of the limitations I came across and fixed on my local branch was the lack of partial interfaces for dependency injection.

I've added the generator in a common project, subclass the generated services (to provide a custom HttpClientHandler for basic auth) and inject.

Another problem I've stumbled across is the tight coupling between the task and visual studio, making the compile/package reinstall thing a bit of a pain as it requires a restart. If I get time I might start a fork that turns the code generator into an external executable and use MustacheSharp for templating. Any thoughts?

Kind regards

Matt

Generated doc comments not properly commenting new lines

The second line in the summary comment is not commented, thus creating a compile-time error.

    /// <summary>
    /// Adds the input user to the specified account, creating the
        user if it does not already exist.
    /// </summary>
    /// <param name="toAccount">The account to add the user to</param>
    /// <returns></returns>

When generating the proxies output you need to prefix the url with a '/'

When generating the proxies output you need to prefix the url with a '/' to force the url to come from the route, currently its trying to resolve relatively which will only work when your on the base url.

Output,..

/* Proxies */

$.proxies.customerapi = {
defaultOptions: {},
antiForgeryToken: defaultAntiForgeryTokenAccessor,



getCustomerById: function (customerId) {
return invoke.call(this, "api/customers/" + customerId, "get",
{
customerId: customerId,
}
);
},

needs to be /api/customers/

Thanks

Add generated C# proxy class to project

Change the current way of hiding the generated code (in the obj folder) to be a explicit file in the project. Also, providing a "blank" class for any user overrides with the generated code as a dependency file - labelled "WebApiProxy.generated.cs"

The Proxy Endpoint

The endpoint URL does not work with sub web applications. If I want to host my service at www.site.com/APIHost, the base host always gets generated as www.site.com.

If /api/proxies is always dependent on the server code, then that portion of the url could removed from the endpoint setting and instead you just use the entire endpoint string as the base HTTPClient url.

OR

New variable in proxy for BaseHostUrl, which gives alternative to endpoint and generates as
BaseHostUrl + "/api/proxies".

Support for enum types as models

Would it be possible to add support for using enum types as models? Currently it's assumed that every model is a class, so enum models get generated as empty classes on the client side.

I wrote a wrapper model around the enum I want to pass to the client and converted the enum values to and from ints, but having the actual enum be available on the client side would be a lot easier.

Generated Proxies Should Create Constructors Accepting Strings/Uris

Hello,

I just noticed that generated clients depend on a hard-coded string that also gets generated. This does not account for environment-specific use cases where the URL of the service will change based on the environment. The generated proxies should create constructors that accept both strings and URIs so that the base address can be assigned via configuration based on the target environment. I will definitely be providing a PR for this. :)

Thank you,
Michael

Cannot use build server for continuous integration

Cannot use CI because of the proxy location is not published to anywhere. It would be nice if we could use a flag to deactivate, on build, the proxy generation and use the already generated proxy class (#4).

Ajax Web Proxy Support and Base URL

Hi, I just noticed that the javascript proxies contain hard coded URLs.
My services domain is different than the website domain which uses the auto generated js client. Since javascript does not allow cross domain ajax calls by default, I have my services behind an AJAX proxy (web proxy) hosted in the website application which forwards requests/responses to and from the services domain.

Eg. To call the Books service https://services.com/api/books, the js client will call https://website.com/api/books. As you'll notice, only the base url is different. Hence is there a way to set the base url in the auto generated js clients? I noticed that there is a $.proxies.baseUrl property. Tried setting it to no avail. Can you help me out?

How do I add custom header using C# generated proxy client?

I have WebApi project, tested the custom header using Postman, works fine. But can't figure out how to add the header using WebApiProxy generated C# client.

 var client = new TestClient();
 client.HttpClient.DefaultRequestHeaders.Add("Clientid", "tester");
 var test = new TestClient().Get("123");

Not sure if I understand it correctly. Appreciate your help. Thanks.

Support MVC 6

The new MVC 6 (ASP.NET 5) should be supported, as it has breaking changes so the WebAPI 2 conventions don't apply.
Do you plan to implement that?

Issue with DocsByReflection nuget package and workaround

Hello, I just wanted to report a problem and a workaround. This happened while using Visual Studio 2015 community edition, installing the package WebApiProxy in a project that uses framework 4.6 the command downlaods DoscByReflection nuget package version 1.0.11 and when I visit /api/proxies I get the error "Could not load file or assembly 'DocsByReflection, 1.0.8.0 The located assembly's manifest definition does not match the assembly reference." What I did was to specifically install the version needed by executing install-package DocsByReflection -Version 1.0.8.0 -DependencyVersion Highest

c# proxy source generated wrong when having route defined

As stated in the title, when I have defined the route for the controller action, c# proxy source fails to compile with error message: 'Type 'MyClient' already defines a member called 'GetAsync' with the same parameter types'. So basically it generates two separate methods: with specific route uri and default 'controller/action' uri, but they both have the same signature.

note: I am defining routes using route table, not attributes

Why EnsureSuccess

why is there an EnsureSuccess function added to the clients in this commit? 59fe0c6 In some servers you get an error response when no data is found (404) or a malformed request is made (403). It's not possible any more to use these services with this project. What is other people's opinion about this? Remove the ensuresuccess function?

Generated C# Client ignores IIS Virtual Directories

Hi,

We've started a new project using the WebApiProxy library and everything worked like a charm. But now we have deployed our Web API Project (server) to an IIS as a virtual directory, this resulted in 404 errors when calling the service from the C# client. Is it possible that the generated classes ignores virtual directories on the service?

For example: when deploying the service to the following url http:///WebApiService, the generated client classes still think the base url is http://. Or am I looking over some kind of config setting?

WebApiProxy.CSharp generated code shows error error: No overload for method 'PutAsJsonAsync' takes 1 arguments

Generated

public virtual async Task<HttpResponseMessage> UpdateProcessedImageFlagAsync(Int32 imageId,Boolean processedImage)
{
    return await HttpClient.PutAsJsonAsync("api/UpdateProcessedImage?imageId=" + imageId + "&processedImage=" + processedImage);
}

I fixed manually like this and it works:

public virtual async Task<HttpResponseMessage> UpdateProcessedImageFlagAsync(Int32 imageId,Boolean processedImage)
{
    return await HttpClient.PutAsJsonAsync("api/UpdateProcessedImage?imageId=" + imageId + "&processedImage=" + processedImage, string.Empty);
}

Dependency on LGPL Licensed DocsByReflection

@faniereynders I noticed that WebApiProxy despite being distributed under the MIT license statically links the LGPL licensed DocsByReflection library. This technically means that you cannot distribute all of your work under MIT. Since LGPL is not commercial friendly (unless dynamically linked), this will be a major restriction on WebApiProxy's adoption by commercial closed source software.

@giacomelli seems to be the creator of DocsByReflection (https://github.com/giacomelli/DocsByReflection). Can you shed some light as well. I have personally had bad experiences with our legal team whenever the LGPL was involved (statically linked) in the past.

http://programmers.stackexchange.com/questions/127749/does-the-mit-open-source-license-implies-work-derivatives-to-be-made-public-und

Also since DocsByReflection is not signed (strong named) this prevents WebApiProxy assemblies from being signed as well. So GAC cannot be used to host them. It would be better to publish signed assemblies via nuget as well so that strong named projects are able to reference WebApiProxy too.

Is it possible to honor JsonIgnore on model?

I have some parameters in Api models that are auto bind to headers. WebApi help page and swagger seems to honor [JsonIgnore], but WebApiProxy always show them in the generated model.

Is there an easy way to change this behavior? Thanks

P.S.

Or [IgnoreDataMember]

C# proxy compile error (Type&) when action method has out parameter

Example:

[HttpGet]
public int GetIntAndString(out string someString)
{
    someString = "hello";
    return 1;
}

Generated method will look like, see String&:

public virtual async Task<HttpResponseMessage> GetIntAndStringAsync(String& generatedSqlQuery)
{
    return await ...
}

Obviously this code can't be compiled. getting Error:
Error 1 Identifier expected

Passing a Dictionary as part of request

Hi,

I have this API Controller in ASPNET MVC:

public void Post([FromBody] Request request)
//...

with this request model:

public class Request
{
        public int ScenarioLocationID { get; set; }
        public int StoreLocationID { get; set; }
        public int VersionID { get; set; }
        public Dictionary<string, string> Properties { get; set; }
}

But when I try to do the following in Javascript. The Properties property has always a length of 0. Before I used the webapiproxy generator it worker ok.

var properties = {};
ko.utils.arrayForEach(self.properties(), function (impactProperty) {
    properties[impactProperty.name] = impactProperty.value;
});

var request = { 
    VersionID: self.versionID, 
    ScenarioLocationID: self.scenarioLocationId(), 
    StoreLocationID: self.storeLocationId(), 
    Properties: properties 
};

$.proxies.controller.post(request).done(function (data) {
//...

Thanks in advance,

Evert

License

Where is the license for this library explicitly stated? I could not find a license file in the code or in nuget package manager.

Custom route template

Hello

When I add a custom route template example

config.Routes.MapHttpRoute(
   name: "DefaultApi",
   routeTemplate: "api/{CompanyId}/{controller}/{id}",
   defaults: new { id = RouteParameter.Optional });

Generates a NullReferenceException

en WebApiProxy.Server.MetadataProvider.<>c__DisplayClass10.<GetMetadata>b__d(ApiParameterDescription b) en System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() en System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() en System.Linq.Buffer`1..ctor(IEnumerable`1 source) en System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) en WebApiProxy.Server.Templates.JsProxyTemplate.TransformText() en WebApiProxy.Server.ProxyHandler.<>c__DisplayClass3.<SendAsync>b__1() en System.Threading.Tasks.Task`1.InnerInvoke() en System.Threading.Tasks.Task.Execute() --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en WebApiProxy.Server.ProxyHandler.<SendAsync>d__6.MoveNext() --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()

Remove 'use strict'

If you have two get methods (same name 'get'), one without a parameter and one with the 'use strict' condition fails when trying to call the proxy.

This is the sample shown working on your description page.

Thanks

NuGet Package Not Current

The classes I generated today using the NuGet package does not seem to create the ClientBase class. Is there some reason it's so out of date compared to the code here?

And on that note, since the NuGet package is out of date, how can I use this code directly? Simply building it and adding the DLL doesn't seem to do it, which isn't too suprising since I'm not sure how it's kicking off the auto-generated code on a build (honestly, that's a bit of magic to me!)

Bug: File WebApiProxySource.cs not added to project

I followed the instructions, but in my client app the file WebApiProxySource.cs is not automatically added to my project. I found that it appears in the folder obj\debug. Right now I have to manually copy and paste this file into my project each time there is an update to the API.

I had a look at the WebApiProxy.CSharp.targets file to try and understand how this file is meant to be copied. It would seem that the $(IntermediateOutputPath) has the incorrect value, but I can't figure out how this is set?

Cannot generate metadata

When calling the metadata endpoint I keep getting an serialization exception. Any sugestions?

Thanks.

{
Message: "An error has occurred.",
ExceptionMessage: "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
ExceptionType: "System.InvalidOperationException",
StackTrace: null,
-InnerException: {
Message: "An error has occurred.",
ExceptionMessage: "Collection was modified; enumeration operation may not execute.",
ExceptionType: "System.InvalidOperationException",
StackTrace: " at System.Collections.Generic.List`1.Enumerator.MoveNextRare()\ \ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\ \ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\ \ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\ \ at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\ \ at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\ \ at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\ \ at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\ \ --- End of stack trace from previous location where exception was thrown ---\ \ at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\ \ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\ \ at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
}
}

C# proxy compile error when comments have miltilines

Hello Fanie,

And thanks for great NuGet package.

Small issue I found, in case class, method (action), property contains multiline comments, for example:
///

/// Line1
/// Line2
/// Line3
///

The generated WebApiProxySource.cs will have the following proxy stub and hit Compile error:
///

/// Line1
Line2
Line3
///

Based on quick look into your T4 template in: https://github.com/faniereynders/WebApiProxy/blob/master/WebApiProxy.Tasks/Templates/CSharpProxyTemplate.tt

Seems like you need to escape properly the following:
<#= definition.Description #>
<#= method.Description #>
<#= p.Description #>

Can you please fix it and release new update?

Thanks a lot, Eli

Silverlight

Any advice for someone with a Silverlight client app? (besides getting off of Silverlight, which will not happen until next year). WebApiProxy.CSharp will not install on Silverlight.

No overload for method 'PostAsJsonAsync' takes 1 arguments

I may be using invalid HTTP verbs but when I have a post action method in a web api controller I get a generated proxy with a PostAsJsonAsync method that is only using one argument and gives me this error.

I can change my verbs up a bit to better reflect the controller but I think this tool should still support this edge case.

Proxies not generated with self hosting scenarios

Hi,

First of all, thank you for the good work !

I am trying to integrate WebApiProxy with a WebApi in a self hosting api based on OWIN.
I have instantiated a new HttpConfiguration so the GlobalConfiguration.Configuration is not set.
Is there something I have missed ?

Thank you for your support

Vincent

I would like to be able to specify different endpoints for code generation and run-time.

The configured endpoint URL gets hard-coded as the value of a static variable (MyWebApiProxyBaseAddress) in the generated .cs file.

I need to be able to generate the proxy against a development endpoint, but target different endpoints at run-time (i.e. so I can move my app through QA, UAT and into a Live environment): the runtime configuration shouldn't require re-generation and re-compilation.

Nice work BTW :-)

DataAnnotations not included in generated

Hi,

Thanks for the awesome proxy generator and the client. I have noticed that in the WebApiProxySource.cs that the Model class that is generated from the proxy does not include any of the data annotations from the web api model. Is there a way to get these included?

WebApiProxy.ConnectionException: WebApiProxy: Could not connect to remote server

I'm getting the following error:

Error 5 The "ProxyGenerationTask" task failed unexpectedly.
WebApiProxy.ConnectionException: WebApiProxy: Could not connect to remote server

But I can browse to my web site on localhost just fine. I have the correct url in the config file in my Windows Application (in same solution as WebApplication)

xsi:noNamespaceSchemaLocation="http://webapiproxy.github.io/schemas/client-config.xsd"
generateOnBuild="true"
endpoint="http://localhost/WebApplication1/api/Values/"
/>

I'm using the default web application with WebAPI. Its using Windows Auth via IIS. The WebApi has a default 'Values' entity.

What could be the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.