Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling different cases #64

Open
daniel-tell opened this issue Dec 21, 2015 · 3 comments
Open

Handling different cases #64

daniel-tell opened this issue Dec 21, 2015 · 3 comments

Comments

@daniel-tell
Copy link

It would be nice if you could pass the case (i.e. camelCase, snake_case etc.) of the api as a parameter, or even better if WebAnchor could recognize it automatically.

@carl-berg
Copy link
Collaborator

The default serializer is the JSON.NET JsonSerializer which has a ContractResolver-property that can be used to change how json is serialized (like the CamelCasePropertyNamesContractResolver). So this can be applied for web anchor like this:

            var myApi = Api.For<ITestApi>(host, new ApiSettings
            {
                ContentSerializer = new ContentSerializer(new JsonSerializer
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                })
            });

@mattiasnordqvist
Copy link
Owner

In this case I know it is about deserializing. The same JsonSerializer that Carl suggests can be used when creating the response parser as well.

@carl-berg
Copy link
Collaborator

Maybe we should be clearer on where to modify serialization. The name ContentSerializer does really reveal wheather it is used for Request content serialization or Reponse content serialization...

Also changing reponse serialization is little bit harder to get to in order to change it (if you don't know where to look), but that's easily solved by documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants