-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] [Restbed] Restbed Generator templates need clean up and refactoring #273
Comments
I'm interested in restbed generator, what I don't like with current implementation is, that it requires to modify generated code, there's no way to inject your own handlers, as restbed does not allow to set REST method handler few times. My idea is to add I've got this working, is there any interest in PR? |
@muttleyxd Please open a PR, so we can take a look |
Hi @stkrwork , Hi @muttleyxd , sorry to go over this "old" issue... I just tried using the restbed server-side generator with both the OpenAPI generator CLI v4.3.1 and v5.0.0-beta2 and I stumped over the same problem described by @muttleyxd : the automatically-generated restbed::Service-derived class is publishing in its constructor the restbed::Resource... how am I supposed to use the generated C++ code? @muttleyxd : did you manage to open a PR ? I could help on that perhaps... Thanks |
Well, I did open a PR, where you can set the callback through the method but now I see it was a bad idea. A good refactor would be to do it like in Pistache generator (PetApi would be class with virtual methods and user would have to override these in their handler code). |
yeah I totally agree - virtual methods look like a better way to make the code extensible rather than callbacks attached to the restbed callbacks... that double layer of callbacks also makes debugging less clear |
For an internal project, I'm improving the generation of restbed code. I'm currently on 5.1.0. But as the generated code is not backwards compatible, I would probably put my changes in a later release. |
Hi guys. Any status on this? Restbed looks like the best platform for us, and I've generated code for it from our OAS 3.1 definition; but I don't really understand how to use it. There are no documents that I can find, and no examples. Aggravating. |
Sorry for the missing documentation. Here some hints how to implement an API. This is code for a newer version of the restbed generator. With your version there are probably more
|
Thanks for the code, but this doesn't help me generate it. I'm looking at modifying the Restbed template or making my own, but the documentation that discusses custom templates and generators does not seem to have orderly procedures in it. Is there any tutorial that shows the complete flow from API-spec document (YAML or JSON) to output code? I assume the generator must parse the OAS document into a common data model, and then pipe that model through the Mustache templates to generate the files. But I can't find any reference to what that data model is or how Mustache works. |
Description
Restbed Generator needs to be reviewed and refactored.
Suggest a fix/enhancement
review current code, and refactor if necessary
The text was updated successfully, but these errors were encountered: