Swagger-codegen: C/C++ generator

Created on 27 Sep 2014  Â·  31Comments  Â·  Source: swagger-api/swagger-codegen

Does anyone know if there are plans to add support in this repo? Otherwise, is there a C/C++ generator elsewhere?

C++ P3 help wanted

Most helpful comment

I'd be happy to tackle the templates, providing a good example client + build instructions were provided.

All 31 comments

I expect we'll have support shortly...

@fehguy thanks. can you point me to some in-progress code?

@fehguy @arschles Any ETA or updates on the C++ generator? My team is looking for exactly this feature.

One flavor should release next weds and should be easily adaptable. What flavor are you working with? What JSON libs, etc?

We are just in the process of selecting appropriate http and JSON libraries (which was surprisingly non obvious). We've made no firm decision yet, and we'd likely go with whatever swagger-codegen supports. Our REST back end is implemented in ServiceStack, and its JSON serializer is very configurable.

I work with @schmidt4brains . boost::property_tree looks pretty good for JSON, but I think JsonCpp would also be OK. boost::network::http looks like it might be the best option for networking, which means boost::future and friends for concurrency.

OK, I'm pretty sure you can port what we've done to use those.

Hi, the C++ templates are now available here:

https://github.com/swagger-api/swagger-codegen/tree/develop_2.0/src/main/resources/tizen

They were generously sponsored by Samsung and should be a good basis for any C++ implementation.

@fehguy - are we going to have a specific C++ implementation or stick with the Tizen one?

@webron after spending time on this, I'm guessing we'll have many different c++ generators based on the frameworks, etc.

If anyone on this thread wants to jump in and donate a template, that would be great.

Should be relatively easy now, for those who know C/C++ - https://github.com/swagger-api/swagger-codegen#making-your-own-codegen-modules.

I have started to implement a C++ generator for Casablanca/cpprest. It is still in its early stages, meaning there are lots of implementation and verification left.
But for the not so faint of heart who wants to test things out, it does creates something that is usable...in labs...check the readme for this fork.
https://github.com/MathiasWasAlreadyTaken/swagger-codegen/tree/development

@MathiasWasAlreadyTaken thanks for the contribution. Would you have time to submit a PR for the Casablanca/cpprest C++ generator? Let me know if you need any help.

Hi @wing328!
As soon as I have something that have been tested and I know works I will create a pull request. Right now I know that it lack lots of functionality that should not go into the main repo.

/Mathias

@MathiasWasAlreadyTaken OK. Please take your time and let us know if you need any assistance.

+1 for cpprest generator. C/C++ strongly needs wider REST base and swagger is the best way

Another +1 for the cpprest sdk generator. PLEASE!!!!

@MathiasWasAlreadyTaken if you've something ready for beta (a partially working C++ client), I would suggest you to submit a PR so that the community can start looking into it and file PRs for improvement.

I would love to be able to work more on this, and the future is looking brighter. I might be able to do some work with it soon, so as soon as I have something that is runnable I'll submit a PR.

Do you have any more work done on it at all? You might get some assistance from others like myself :)

@MathiasWasAlreadyTaken thanks for the update. Please take your time.

(My suggestion is that even though you've partially-finished c++ generator that's not runnable yet, it's still good to submit a PR to let the community helps improve it to make it runnable)

@schmidt4brains you asked above (a long time ago) if I have any updates or have made any progress. Just FYI that I don't and am not currently planning on working on the C++ generator anymore

@arschles Thanks for the update. My team has taken an alternative approach to C++ code generation (they are basically hand-coding a wrapper layer for each REST endpoint they consume). It still feels like boilerplate work to me, but they are happy with it.

I'd be happy to tackle the templates, providing a good example client + build instructions were provided.

Here is another update related to C++ generator:

https://github.com/swagger-api/swagger-codegen/issues/2704#issuecomment-225537925

We have C++ for QT + CPPRest so time to close this.

Am I wrong or there is no server version for this two ? (qt5cpp-server, cpprest-server ?)

@itschrono there are C++ server generators for Pistache and Restbed. Would that meet your requirement?

I guess it will for my C++ (Qt5 standalone software). Now I may need a visual basic client (I known it's lame xD) see #6831

Was this page helpful?
0 / 5 - 0 ratings