Made camelize model properties configurable and fixed swagger_model name capitalization issue #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses #49 by introducing a new configuration property
:camelize_model_properties
. The default value is true to maintain backward compatibility. If set to false, it uses the model properties exactly the way they are passed in.I also had an issue where if the model name was not camelcased, the model name in the parameter type field wouldn't match the key in the models hash.
You can see that the type of the "order_data" param ("OrderData") does not match up the it's key in the models hash ("orderData"). This was causing issues in the swagger ui because it couldn't find a model definition with a key of "OrderData".
Finally, to ease testability, I extracted a class called ApiDeclarationFile that is named after the Api declaration files in the swagger spec (https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#52-api-declaration). This class's responsibility is to build the resource hash that will be serialized as json and written out to a file. I made sure all of your test coverage passed and wrote my own coverage as it went.
Let me know if you have any feedback. I'm excited that I could fix these issues.