Skip to content
Permalink
Browse files

bug fixes

  • Loading branch information...
zijianhuang committed May 6, 2018
1 parent 2c3c480 commit f247f4dd69ddc2a0ce3fe53b36ca32149d6f4dd1
Showing with 2,731 additions and 1,352 deletions.
  1. +82 −6 DemoCoreWeb.ClientApi/WebApiClientAuto.cs
  2. +27 −13 DemoCoreWeb/Controllers/ValuesController.cs
  3. +23 −4 DemoCoreWeb/Scripts/ClientApi/WebApiClientAuto.ts
  4. +7 −0 DemoCoreWeb/Startup.cs
  5. +24 −5 DemoNGCli/NGSource/src/clientapi/WebApiNG2ClientAuto.ts
  6. +32 −0 DemoWebApi.ClientApi/WebApiClientAuto.cs
  7. +10 −5 DemoWebApi/Controllers/ValuesController.cs
  8. +9 −0 DemoWebApi/Scripts/ClientApi/WebApiClientAuto.ts
  9. +7 −4 Fonlow.Web.MetaShared/WebApiDescription.cs
  10. +18 −7 Fonlow.Web.MetaTransformCore/MetaTransform.cs
  11. +2 −7 Tests/IntegrationTests/IntegrationTests.csproj
  12. +52 −0 Tests/IntegrationTests/SpecialTypesIntegration.cs
  13. +30 −30 Tests/{IntegrationTests → IntegrationTestsCore}/BasicHealthIntegration.cs
  14. +210 −0 Tests/IntegrationTestsCore/EntitiesApiIntegration.cs
  15. +20 −0 Tests/IntegrationTestsCore/IntegrationTestsCore.csproj
  16. +501 −0 Tests/IntegrationTestsCore/SuperDemoIntegration.cs
  17. +196 −0 Tests/IntegrationTestsCore/TupleApiIntegration.cs
  18. +118 −0 Tests/IntegrationTestsCore/ValuesApiIntegration.cs
  19. +30 −0 Tests/IntegrationTestsShared/BasicHealthIntegration.cs
  20. +232 −232 Tests/{IntegrationTests → IntegrationTestsShared}/EntitiesApiIntegration.cs
  21. +151 −151 Tests/{IntegrationTests → IntegrationTestsShared}/FileUploadIntegration.cs
  22. +27 −27 Tests/{IntegrationTests → IntegrationTestsShared}/IisExpressCollection.cs
  23. +20 −0 Tests/IntegrationTestsShared/IntegrationTestsShared.projitems
  24. +13 −0 Tests/IntegrationTestsShared/IntegrationTestsShared.shproj
  25. +518 −546 Tests/{IntegrationTests → IntegrationTestsShared}/SuperDemoIntegration.cs
  26. +196 −196 Tests/{IntegrationTests → IntegrationTestsShared}/TupleApiIntegration.cs
  27. +118 −118 Tests/{IntegrationTests → IntegrationTestsShared}/ValuesApiIntegration.cs
  28. +25 −1 WebApiClientGen.sln
  29. +33 −0 WebApiClientGenCore/ApiExplorerVisibilityEnabledConvention.cs
@@ -905,11 +905,11 @@ public void UpdatePerson(DemoWebApi.DemoData.Client.Person person)
}

/// <summary>
/// PUT api/Entities/link
/// PUT api/Entities/link?id={id}&relationship={relationship}
/// </summary>
public async Task<bool> LinkPersonAsync(long id, string relationship, DemoWebApi.DemoData.Client.Person person)
{
var requestUri = new Uri(this.baseUri, "api/Entities/link");
var requestUri = new Uri(this.baseUri, "api/Entities/link?id="+id+"&relationship="+Uri.EscapeDataString(relationship));
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create();
@@ -927,11 +927,11 @@ public async Task<bool> LinkPersonAsync(long id, string relationship, DemoWebApi
}

/// <summary>
/// PUT api/Entities/link
/// PUT api/Entities/link?id={id}&relationship={relationship}
/// </summary>
public bool LinkPerson(long id, string relationship, DemoWebApi.DemoData.Client.Person person)
{
var requestUri = new Uri(this.baseUri, "api/Entities/link");
var requestUri = new Uri(this.baseUri, "api/Entities/link?id="+id+"&relationship="+Uri.EscapeDataString(relationship));
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create();
@@ -4190,6 +4190,70 @@ public string[] Get()
}
}

/// <summary>
/// GET api/Values/{id}?name={name}
/// </summary>
public async Task<string> GetAsync(int id, string name)
{
var requestUri = new Uri(this.baseUri, "api/Values/"+id+"?name="+Uri.EscapeDataString(name));
var responseMessage = await client.GetAsync(requestUri);
responseMessage.EnsureSuccessStatusCode();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// GET api/Values/{id}?name={name}
/// </summary>
public string Get(int id, string name)
{
var requestUri = new Uri(this.baseUri, "api/Values/"+id+"?name="+Uri.EscapeDataString(name));
var responseMessage = this.client.GetAsync(requestUri).Result;
responseMessage.EnsureSuccessStatusCode();
var stream = responseMessage.Content.ReadAsStreamAsync().Result;
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// GET api/Values?name={name}
/// </summary>
public async Task<string> GetAsync(string name)
{
var requestUri = new Uri(this.baseUri, "api/Values?name="+Uri.EscapeDataString(name));
var responseMessage = await client.GetAsync(requestUri);
responseMessage.EnsureSuccessStatusCode();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// GET api/Values?name={name}
/// </summary>
public string Get(string name)
{
var requestUri = new Uri(this.baseUri, "api/Values?name="+Uri.EscapeDataString(name));
var responseMessage = this.client.GetAsync(requestUri).Result;
responseMessage.EnsureSuccessStatusCode();
var stream = responseMessage.Content.ReadAsStreamAsync().Result;
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// GET api/Values/{id}
/// </summary>
@@ -4225,7 +4289,7 @@ public string Get(int id)
/// <summary>
/// POST api/Values
/// </summary>
public async Task PostAsync(string value)
public async Task<string> PostAsync(string value)
{
var requestUri = new Uri(this.baseUri, "api/Values");
using (var requestWriter = new System.IO.StringWriter())
@@ -4235,13 +4299,19 @@ public async Task PostAsync(string value)
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
var responseMessage = await client.PostAsync(requestUri, content);
responseMessage.EnsureSuccessStatusCode();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}
}

/// <summary>
/// POST api/Values
/// </summary>
public void Post(string value)
public string Post(string value)
{
var requestUri = new Uri(this.baseUri, "api/Values");
using (var requestWriter = new System.IO.StringWriter())
@@ -4251,6 +4321,12 @@ public void Post(string value)
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
var responseMessage = this.client.PostAsync(requestUri, content).Result;
responseMessage.EnsureSuccessStatusCode();
var stream = responseMessage.Content.ReadAsStreamAsync().Result;
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}
}

@@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Fonlow.CodeDom.Web;

namespace DemoWebApi.Controllers
{
@@ -16,21 +17,34 @@ public IEnumerable<string> Get()
return new string[] { "value1", "value2" };
}

// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
[HttpGet("{id}")]
public string Get(int id, [RequiredFromQuery] string name)
{
return name + id.ToString();
}

// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
[HttpGet]
public string Get([RequiredFromQuery] string name)
{
return name.ToUpper();
}

[HttpGet("{id}")]
public string Get(int id)
{
return id.ToString();
}

// POST api/values
[HttpPost]
public string Post([FromBody]string value)
{
System.Diagnostics.Debug.WriteLine("received POST value: " + value);
return value.ToUpper();
}

// PUT api/values/5
[HttpPut("{id}")]
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
@@ -141,14 +141,14 @@ namespace DemoWebApi_Controllers_Client {
}

/**
* PUT api/Entities/link
* PUT api/Entities/link?id={id}&relationship={relationship}
* @param {number} id
* @param {string} relationship
* @param {DemoWebApi_DemoData_Client.Person} person
* @return {boolean}
*/
linkPerson(id: number, relationship: string, person: DemoWebApi_DemoData_Client.Person, callback: (data : boolean) => any){
this.httpClient.put(this.baseUri + 'api/Entities/link', person, callback, this.error, this.statusCode);
this.httpClient.put(this.baseUri + 'api/Entities/link?id='+id+'&relationship='+encodeURIComponent(relationship), person, callback, this.error, this.statusCode);
}

/**
@@ -924,6 +924,25 @@ namespace DemoWebApi_Controllers_Client {
this.httpClient.get(this.baseUri + 'api/Values', callback, this.error, this.statusCode);
}

/**
* GET api/Values/{id}?name={name}
* @param {number} id
* @param {string} name
* @return {string}
*/
getByIdAndName(id: number, name: string, callback: (data : string) => any){
this.httpClient.get(this.baseUri + 'api/Values/'+id+'?name='+encodeURIComponent(name), callback, this.error, this.statusCode);
}

/**
* GET api/Values?name={name}
* @param {string} name
* @return {string}
*/
getByName(name: string, callback: (data : string) => any){
this.httpClient.get(this.baseUri + 'api/Values?name='+encodeURIComponent(name), callback, this.error, this.statusCode);
}

/**
* GET api/Values/{id}
* @param {number} id
@@ -936,9 +955,9 @@ namespace DemoWebApi_Controllers_Client {
/**
* POST api/Values
* @param {string} value
* @return {void}
* @return {string}
*/
post(value: string, callback: (data : void) => any){
post(value: string, callback: (data : string) => any){
this.httpClient.post(this.baseUri + 'api/Values', value, callback, this.error, this.statusCode);
}

@@ -30,7 +30,10 @@ public void ConfigureServices(IServiceCollection services)
options.Conventions.Add(new ApiExplorerVisibilityEnabledConvention());
}
);

//https://stackoverflow.com/questions/28435734/get-list-of-all-routes

services.AddRouting();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -42,6 +45,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}

app.UseMvc();
//app.UseMvc(routes =>
//{
// routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
//});
}
}
}
@@ -146,14 +146,14 @@ export namespace DemoWebApi_Controllers_Client {
}

/**
* PUT api/Entities/link
* PUT api/Entities/link?id={id}&relationship={relationship}
* @param {number} id
* @param {string} relationship
* @param {DemoWebApi_DemoData_Client.Person} person
* @return {boolean}
*/
linkPerson(id: number, relationship: string, person: DemoWebApi_DemoData_Client.Person): Observable<boolean>{
return this.http.put<boolean>(this.baseUri + 'api/Entities/link', JSON.stringify(person), { headers: new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) });
return this.http.put<boolean>(this.baseUri + 'api/Entities/link?id='+id+'&relationship='+encodeURIComponent(relationship), JSON.stringify(person), { headers: new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) });
}

/**
@@ -934,6 +934,25 @@ export namespace DemoWebApi_Controllers_Client {
return this.http.get<Array<string>>(this.baseUri + 'api/Values');
}

/**
* GET api/Values/{id}?name={name}
* @param {number} id
* @param {string} name
* @return {string}
*/
getByIdAndName(id: number, name: string): Observable<string>{
return this.http.get<string>(this.baseUri + 'api/Values/'+id+'?name='+encodeURIComponent(name));
}

/**
* GET api/Values?name={name}
* @param {string} name
* @return {string}
*/
getByName(name: string): Observable<string>{
return this.http.get<string>(this.baseUri + 'api/Values?name='+encodeURIComponent(name));
}

/**
* GET api/Values/{id}
* @param {number} id
@@ -946,10 +965,10 @@ export namespace DemoWebApi_Controllers_Client {
/**
* POST api/Values
* @param {string} value
* @return {void}
* @return {string}
*/
post(value: string): Observable<Response>{
return this.http.post<Response>(this.baseUri + 'api/Values', JSON.stringify(value), { headers: new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) });
post(value: string): Observable<string>{
return this.http.post<string>(this.baseUri + 'api/Values', JSON.stringify(value), { headers: new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) });
}

/**
@@ -4484,6 +4484,38 @@ public string Get(string name)
}
}

/// <summary>
/// GET api/Values/{id}
/// </summary>
public async Task<string> GetAsync(int id)
{
var requestUri = new Uri(this.baseUri, "api/Values/"+id);
var responseMessage = await client.GetAsync(requestUri);
responseMessage.EnsureSuccessStatusCode();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// GET api/Values/{id}
/// </summary>
public string Get(int id)
{
var requestUri = new Uri(this.baseUri, "api/Values/"+id);
var responseMessage = this.client.GetAsync(requestUri).Result;
responseMessage.EnsureSuccessStatusCode();
var stream = responseMessage.Content.ReadAsStreamAsync().Result;
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<string>(jsonReader);
}
}

/// <summary>
/// POST api/Values
/// </summary>
@@ -22,12 +22,17 @@ public string Get(int id, string name)
return name + id.ToString();
}

public string Get(string name)
{
return name.ToUpper();
}
public string Get(string name)
{
return name.ToUpper();
}

public string Get(int id)
{
return id.ToString();
}

[HttpPost]
[HttpPost]
public string Post([FromBody]string value)
{
System.Diagnostics.Debug.WriteLine("received POST value: "+value);
Oops, something went wrong.

0 comments on commit f247f4d

Please sign in to comment.
You can’t perform that action at this time.