DEV Community

Ambassador
Ambassador

Posted on • Originally published at getambassador.io

From C# to Kotlin: A Deep Dive into Blackbird’s Expanded Language Support

Blackbird API Development offers support for multiple languages and frameworks, giving users the flexibility to create APIs in the technology stack of their choice. This feature streamlines API development by integrating seamlessly into existing workflows.

The code generator leverages a robust library of server stubs and client libraries, eliminating the need for users to implement and maintain their own templates. This enhances productivity and reduces friction in adoption across diverse development environments.

Meeting Developers Where They’re At

In today’s world, many factors are involved when choosing a language, a framework, or even an HTTP client. These factors include the particular problem the developer needs to solve, the team's expertise, and, ultimately, the existing stack and tools they already have in place.

In rare situations, there might also be some legal implications. That, combined with the large number of languages and frameworks available, tends to make the overall deciding process quite complex at times.

That is why it’s important to have a tool in one’s toolbox that supports varying needs that may change over time. After all, it’s always great if the tools you use don’t impose any limits on you, follow you along your journey, and, most importantly, can be relied on no matter what your next challenge is.

Additionally, we recognized the importance of extending the range of languages supported out of the box in Blackbird to ensure that current users who favor microservice, often polyglot architectures and frequently generate new services across multiple languages could easily utilize Blackbird for automated code generation.

The New Update with OpenAPI Generator

The support for many languages in the Blackbird code generation feature helps simplify decision-making by taking “does our tool support X” out of the equation when making a crucial choice for the next project. Having a tool you can trust and incorporate into many of your multi-language projects, whether new or existing, lets you focus more on what matters the most—the problem to solve. A tool you use should never be yet another problem to solve.

In Blackbird, developers can enjoy an extensive suite of targets while reducing maintenance to the minimum. Plus, the templates are configurable, making it straightforward to tailor the output to an individual’s needs.

There are many different open source project code generators supporting OpenAPI these days, and we went with the well-known tool openapi generator to build up our language support. While one may argue that it’s not the de facto standard tool, it’s certainly one of the tools a developer evaluates as one of their first options.

OpenAPI Generator is a powerful open-source tool that streamlines API development by automatically generating client SDKs, server stubs, API documentation, and configuration files based on OpenAPI specifications. Supporting over 50 languages and frameworks, OpenAPI Generator enables developers to accelerate their workflows, reduce manual coding, and ensure consistency across projects. With its customizable templates and extensive community support, OpenAPI Generator is a go-to resource for dev teams looking to enhance productivity and focus on building robust, scalable APIs instead of repetitive boilerplate code.

This open-source project tool provided the many different client libraries and server framework targets that we were seeking. One of its perks is that there’s no vendor lock-in, and many in our developer community already love and know openapi-generator well.

Languages Available in Blackbird

Ada: Specialized for high-integrity and safety-critical systems.
C#: Robust support for ASP.NET Core and Azure Functions, streamlining .NET development.
C++: Compatibility with Pistache, Restbed, and Qt5 QHTTPEngine for building efficient APIs.
Erlang: Ideal for concurrent and distributed system development.
Go: Integrated with net/http, Gin, and Echo to optimize lightweight and scalable API creation.
Haskell: Support for Servant and Yesod frameworks, enabling functional programming for API design.
Java: Comprehensive coverage for frameworks like Spring, Vert.x, JAX-RS, and Apache Camel.
Kotlin: Seamless integration with Spring Boot, Ktor, and Vert.x for modern Android and JVM development.
PHP: Extensive support for Laravel, Symfony, Slim, and more to enhance web application development.
Python: Framework support for FastAPI and Flask, enabling rapid API prototyping and development.
Rust: Optimized for high-performance systems with Rust-server integration.
Node.js: Enhanced JavaScript API development for web and server-side applications.
Ruby: Support for Sinatra and Rails 5 for dynamic web application development.
Scala: Includes frameworks like Akka, Play, and Scalatra for scalable and concurrent API systems

Future-Proofing Development with Blackbird

Although, at the moment, our integration of OpenAPI generator is on par with the open source project, down the line, we are planning to bring enhancements to reduce the number of code changes to the bare minimum. One of my dreams moving forward for Blackbird includes making it so that you wouldn’t even need to implement the endpoint handler (wouldn’t that be awesome?!). Looking forward to our Blackbird roadmap, here are some things we’re thinking about next.

One thing we want to add in the future for Blackbird to our CodeGen feature is the ability to enhance the generated code even further with the assistance of AI to simplify repetitive processes.

For example, let’s be frank - most endpoints in a simple CRUD application do have some similarities.

In the majority of cases, the steps one needs to perform are more or less the same set of steps:

We need to check authentication, apply RBAC, verify entitlements, etc. Luckily, some can be done on the middleware level, so at least here–we don’t need to repeat ourselves too much.
We then may need to check a specific entitlement or permission specific to a given resource class.

The next step is usually the validation of the payload to ensure it conforms to the contract that ideally would be defined in some API description format such as OpenAPI.

Once you know the request is well formed and the user is authorized to access it, you usually access the resources from some database (unless it’s the create operation, obviously) and handle some common exceptions (such as if the resource does not exist).
Then you eventually make some changes to the database if it’s not the read operation.

Ultimately, what’s left is returning some response that should also be part of your contract.

Obviously, the steps may be slightly different in some cases. For example, you may need to set pagination or schedule a task.

Another repetitive part is tests. Eventually, our goal with Blackbird is to get rid of the majority of that hassle and let developers put emphasis on different areas of their application that usually require more thought process and a more careful design and implementation.

Truly, when it comes to Blackbird future proofing, we are focused on all things low-code platforms and things that better streamline AI-assisted development workflows.

Top comments (0)