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

Model and Model Schema camelcase in json #113

Closed
thinkMichel opened this issue Nov 5, 2014 · 6 comments
Closed

Model and Model Schema camelcase in json #113

thinkMichel opened this issue Nov 5, 2014 · 6 comments

Comments

@thinkMichel
Copy link

Since c# members are Uppercase by convention, and json properties are lowercase by convention, there is a setting for your WebApi project to force the json formatter to automatically convert to lowercase:


[inside global.asax, Application_Start]

GlobalConfiguration.Configuration
         .Formatters
         .JsonFormatter
         .SerializerSettings
         .ContractResolver = new CamelCasePropertyNamesContractResolver();

It would be nice if swashbuckle automatically picks up on this contract (if at all possible, since the application_start method may run after/before the WebActivator?).

If not possible, it would be nice to have a configuration option that converts the documentation to accurately represent the web service.

@andyalm
Copy link
Collaborator

andyalm commented Nov 5, 2014

This is planned for the next major release (5.0). I'm actually working on it right now :-). I expect it to be merged into the swagger_2.0 branch either today or tomorrow.

@thinkMichel
Copy link
Author

Nice! prevents me from having to add comments such as "note that you should use camelcase" etc :)

@domaindrivendev domaindrivendev added this to the v5.0.0-alpha milestone Nov 7, 2014
@CumpsD
Copy link

CumpsD commented Nov 27, 2014

Did this get merged? Was looking for this today as well

@304NotModified
Copy link
Contributor

I'm also waiting for this :)

@domaindrivendev
Copy link
Owner

Swashbuckle 5.0 Alpha now available as a pre-release package. Corresponding docs available here. This release should resolve your issue. I would really appreciate you checking it out when you get a chance. If the problem is not resolved go ahead and re-open the issue with any additional information. Thanks

@jchadwick
Copy link

Uncanny. Just searched for the package an hour ago as you were pushing it up. Thanks!

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

No branches or pull requests

6 participants