CrshOverride / ember-web-api

Ember Data Addon for .NET Web API Endpoints
MIT License
20 stars 12 forks source link

Added conversion between the different JSON property name casings in … #10

Closed ZoolWay closed 8 years ago

ZoolWay commented 8 years ago

…JSON API and ASP.NET Web API

I was wondering why you change the JSON casing on the .NET WebAPI server side. I would prefer an approach either to only adopt Ember.js with adapter/serializer to speak to native .NET WebAPI or have the ASP.NET service return JSON API which is compatible with Ember Data.

Therefore I have adopted the code a bit to make it work without changing the JSON serialization on the ASP.NET application.

My versions: DNX 4.5.1, Asp.Net MVX 6.0.0-rc1-final, Ember 2.5.1, Ember Data 2.5.2

This may break backward-compatibility so it would be nice to have a configuration setting to enable/disable this conversion. But I am not very deeply into Ember.js yet and especially not addon development so maybe you can add something to have a switch?

CrshOverride commented 8 years ago

I chose to require the case-change on the server-side simply because:

  1. It forces the API to adhere to standard JSON naming conventions (which the majority of the projects I work on already do by default).
  2. It enables easy re-use of the adapter by nearly any API that returns nested JSON objects (even though the name says Web API).

If you added a configuration flag to support either case (I'd prefer the current handling to be the default) and can get tests working, I'd be happy to merge in this support.

ZoolWay commented 8 years ago

Thanks for your answer. As said, I am not into ember plugins and currently we dropped this project. So unfortunately I will not be able to complete that. You might drop this PR.