Swagger-codegen: [C++] Style Guide for C++ API client

Created on 23 Jun 2016  路  7Comments  路  Source: swagger-api/swagger-codegen

Description

We want the auto-generated C++ API client (Qt5, Tizen, REST SDK) to follow the Google C++ style guide: https://google.github.io/styleguide/cppguide.html

Here are some examples: http://stackoverflow.com/questions/3062277/sample-code-with-examples-for-the-c-google-style-guide

Swagger-codegen version

2.2.0 or later

Suggest a Fix

If anyone from the community has cycle to work on this, please reply to let us know and we'll show you some good starting points.

C++ Feature help wanted

Most helpful comment

Just to inform you if you change the qt5cpp generator style: I am in the middle of rewriting the qt5cpp generator and submitting a breaking PR for it - will try to keep the Google C++ style in mind.

All 7 comments

I might be interested in this, as I might want to use swagger-codegen to generate a couple of different clients, among others, c++.

I'm new to this codebase, so I can use all the starting points you have to suggest.

edit: Am I correct to think there are multiple C++ generators? O.O

@GlenDC thanks for offering help on improving the code style for C++ generators.

You're correct in saying that there are more than 1 C++ generator as follows:

  • cpprest(using https://github.com/Microsoft/cpprestsdk)
  • qt5cpp (for Qt5: http://doc.qt.io/qt-5/qt5-intro.html)
  • tizen (for Tizen: https://www.tizen.org/)

I recently submitted https://github.com/swagger-api/swagger-codegen/pull/4379 to improve the code quality of cpprest API client. That may also serve as a good starting point.

Just to inform you if you change the qt5cpp generator style: I am in the middle of rewriting the qt5cpp generator and submitting a breaking PR for it - will try to keep the Google C++ style in mind.

Cool, than I don't think there is something for me to gain here, as I was only truly interested in the cpprest one, and optionally qt5cpp.

@GlenDC you may want to consider adding automated documentation for C++ (cpprest) API client.

I've recently done something similar for C# 2.0 generator: https://github.com/swagger-api/swagger-codegen/pull/4354 and I'm sure C++ developers (especially beginner) will find the installation and code samples helpful in using the C++ SDK.

The generated Tizen C++ Client follows the Tizen coding style (which you can find here) as far as easily feasible.

Since the Tizen C++ client generates code specifically for the Tizen environment (and not other platforms), I think following Tizen style rather than Google for this particular generator is ideal.

@akhilkedia agreed. I've updated https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md#style-guide accordingly.

Was this page helpful?
0 / 5 - 0 ratings