How to contribute to Open Source – Shown on an example

10.01.2023

Open Source is great! Without exaggerating, it can be said that our world runs on open source software. I bet every one of us gets in touch with it at least once a day.

Especially Android users since it’s an open source operating system for mobile devices. Or just think about how many open source libraries you’re using in your software projects. Isn’t this fascinating? Everyone can access the source code to review, extend and improve it. In my opinion, it’s an important part of sustainable software development. This begs the question how can one participate? How do you start?

Find something you can contribute

This is a question that seemed impossible for me to answer. In many conversations, I noticed that I’m not the only one who struggles with it. Most answers didn’t help me. Therefore, I thought to share an example with you. Let me tell you about one of my pull requests to an open source project: It all started at work. We were building a new microservice. It was built with Java and Spring Boot. Our microservice had to connect to an external REST API. Their API was secured by OAuth2. We simply added spring-boot-starter-oauth2-client as a dependency to our maven project. Or so we thought but there was a catch. To use the functionality of this dependency we had to use WebClient instead of RestTemplate which we used in all our other microservices. Using WebClient instead of RestTemplate, in general, was no big deal but there was one thing we didn’t like: The logging of requests and responses. The HTTP client – default is reactor-netty – only had two ways of logging requests. None of them were fitting for us. Probably not only for us but also for other people. Wouldn’t another logging option be a good contribution?

Bring it to life

My next step was to look for the repository of reactor-netty. I found it on Github and there were a few open issues that dealt with the exact same topic. This confirmed my assumptions, that we weren’t the only ones struggling with it and it only motivated me more to contribute to the project to offer a solution to our problem. On the same day, I created the first pull request as a draft. This pr was mostly used to discuss a solution with Violeta who is the maintainer of this project. The next day I created the final pull request which after a few days made it finally into the master branch.

HttpClient httpClient = HttpClient
  .create()
  .wiretap("reactor.netty.http.client.HttpClient", LogLevel.DEBUG, AdvancedByteBufFormat.TEXTUAL);

The snippet above shows my contribution in use. In my pull request, I added the AdvancedByteBuffFormat enum and the functionality behind the TEXTUAL option.

People are going to use it

I changed projects before my changes in reactor-netty were available within spring-boot-starter-oauth2-client. But a year later one of my colleagues – without me telling him – found the new solution for logging. A few weeks ago I saw this by coincidence when another colleague asked me something about the code in my old project. I was so proud to see that my open source code made it into the project. It’s a very rewarding feeling. Also knowing that they came upon it, means that also other people must have found it too. This made me curious how they found it and then I discovered a small paragraph on Baeldung – a website you probably know if you’re a Spring developer – on how to use my logging. Incredible feeling.

Try it yourself

I really hope that this blog post and my example showed you, how easy it is to contribute to open source. Creating this PR wasn’t time-consuming. If I had to guess I took about 4 – 5 hours in time. Definitely well invested. Just try it for yourself: Have you ever contributed to open source? Do you want to? Feel free to comment or contact me if you have any questions about it.

Zurück zur Übersicht

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*Pflichtfelder

*