gabrewer.com

Life is too important to be take seriously.

My first pull request - WebApiContrib.Formatting.CollectionJson

Saturday, August 17, 2013 at 8:39 PM UTC

In my latest project I am using the great Collection+Json ASP.NET Web API library that Glenn Block put up on GitHub a while ago.  After using it for a while I decided to refactor my code and use something other than an int for my type identifiers.  When I changed to use the generic type, I discovered an issue with the code that had added the generic identifier capability to the library.  The Create method was still retuning an int instead of the generic TId.

So I wrote up the issue on GitHub and Glenn Block immediately responded asking if I was going to submit a Pull Request.  I am still relatively new to git and am still trying to grok it.  But since I had already forked the repository and updated the code, I figured this would be as good time as any to figure how to submit a pull request. 

Even though it was a one line change to the return type of the Create method, I realized that there were no unit tests for the CollectionJsonController class taking a generic identifier value.  So I decided I should fix that as well and created a XUnit test for this scenario by cloning the existing tests with just a Controller that used a string for the identifier.  Once I had the tests and the code working, I went about figure out how to submit my first pull request.

I found an excellent resource that made the process relativity straight forward and painless.  https://www.openshift.com/wiki/github-workflow-for-submitting-pull-requests 

You can find my first pull request (modest as it may be) at

https://github.com/WebApiContrib/WebApiContrib.Formatting.CollectionJson/pull/12#issuecomment-22815387