joukevandermaas / saule

JSON API library for ASP.Net Web API 2.
https://joukevandermaas.github.io/saule
MIT License
76 stars 37 forks source link

Property names in nested data structrures are kebab-cased even if CamelCasePropertyNameConverter is provided #192

Closed Bazaleev closed 6 years ago

Bazaleev commented 6 years ago

Hi all,

Thanks for the great library. There is an inconsistency in data serialization when we opt in for CamelCase serialization. Root level properties are serialized as expected but all properties in nested data models are kebab-cased. So it looks like this: { "data": { "type": "table-filter", "id": "12", "attributes": { "isDefault": false, "orderBy": { "field-name": "Field2", "is-descending": true }, "where": [ { "field-name": "Field1", "condition": "=", "value": "5" } ] } }, "links": { "self": "http://example.com/api/people/123" } }

The issue can be easily fixed if we pass IPropertyNameConverter (provided in ResourceSerializer) to JsonApiContractResolver.

Thanks!

joukevandermaas commented 6 years ago

@Bazaleev Thanks for reporting this! I will create a patch release for this fix: 1.7.1.