swagger-api / swagger-api/swagger-codegen

C++ generated code creates boost dependency

Open
#9,414 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

The C++ generated code creates additional dependencies on the boost library for the developer.

This has serious ramifications for the developer, who may not have the luxury of arbitrarily adding additional overhead into their organization's build repository.

I am of the opinion that generated code should stay as clean as possible and not introduce any additional, unnecessary, dependencies, without the explicit permission of the user. C++ class interfaces even carry a greater responsibility and burden.

I would suggest reading:

[https://www.amazon.com/Large-Scale-Software-Design-John-Lakos/dp/0201633620]

From what I can tell, the boost features you are using are minimal.

  • boost::optional
  • boost::replace_all
  • boost::uuids::random_generator

I would greatly prefer a type pointer to param in lieu of boost::optional culturing up the class interfaces. I think I am experienced enough to know to how to add doxygen "optional parameter" comments.

As far as replace-all & random_generator, these could easily be replaced by generated local helper-function code without introducing any additional dependencies.

Please provide a -NO_BOOST option for your swagger_codegen tool.

Respectfully,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the swagger_codegen entry point and inspect how the C++ generated code uses boost::optional, boost::replace_all, and boost::uuids::random_generator. Done means a -NO_BOOST option prevents those generated dependencies while preserving the requested generated-code behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.