How best to go about proposing (and helping with) code-generation improvements?

Howdy, all! I’m new around here (although a longtime member of the Scala community). This is basically a preliminary question about process. Some context, to get started:

My dayjob is essentially the successor company to a big old Scala shop, built around microservices. Those services are largely connected via OpenAPI specs – we made a conscious decision, many years ago, to go spec-first: that is, the specs are hand-maintained, then we code-generate the controller endpoints and hook the logic up to those. It’s a bit of extra ceremony, but that’s intentional: it makes it harder to change the contract by accident. So we care passionately about the code-generation side of the equation, and the resulting generated code.

We have quite a lot of internal tooling to support that, much of which (unsurprisingly) bears some resemblance to Tapir – we started building out those internal libraries 10+ years ago, and they’re quite battle-hardened at enterprise scale by now.

Which is great, but also kind of a pain. Tapir wasn’t an option a decade ago, but it is now, and we’d kind of like to get away from maintaining an internal library stack that now has a good open-source alternative, especially for our net-new services.

I’ve just tried adapting one of our new services to Tapir, using its code generator in the way we’re used to doing. On the plus side, I got that working. On the minus side, there are several ways in which the resulting code is sub-optimal, especially from a types POV.

So I have four different aspects in which I’d love to see enhancements to the code generator, ranging from “nice to have” to “I think this is a significant bug”. I’m happy to work with y’all to make those happen (at this point, the alternative is me spending that time enhancing our old internal stuff), but I’d like to open the conversation ASAP to make sure that they’re actually feasible. All of them would entail changes to the generated code, which presumably needs some serious discussion and process – I’m hoping that they’re all possible (some probably gated by flags, where the changes are source-incompatible), but I don’t think I can assume that offhand, since I assume there are people currently using the existing code generator in production.

So how would you prefer that I manage this? Create issues on the GH repo? Start conversations here? Just describe all of them here in a single thread? My primary immediate concern is just coming to some consensus that these are things that can/should be enhanced, which would help my team feel more comfortable about transitioning away from our own very-mature (but honestly, a pain to maintain) bespoke code generator, towards helping out with something shared with the larger community.

1 Like

That sounds great :slight_smile: The main author & maintainer of the codegen module is hughsimpson · GitHub . So if you have some specific ideas for things that might be improved, I think the best way forward would be to create issues, tag Hugh there so that everybody necessary is involved, and proceed from there.

1 Like