Skip to content
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

[Qt5 Server] Add Support for Qt5 server using QHttpEngine #322

Merged
merged 21 commits into from
Jul 26, 2018

Conversation

etherealjoy
Copy link
Contributor

@etherealjoy etherealjoy commented Jun 14, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.1.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Qt5 Server based on QHttpEngine

  • Supports Transient Objects for Multi Requests
  • Supports Query parameters
  • Supports Path Parameters
  • Support Serialization/DeSerialization of Response/Request
  • Run and build in debian stretch slim container

Missing Support

Related to discussion in #268

@stkrwork @MartinDelille @ravinikam @fvarose @wing328

@wing328
Copy link
Member

wing328 commented Jun 14, 2018

Suggestion: You may consider creating an abstract "AbstractCppQt5Codegen.java" class for both Qt5 client and server codegen classes in this PR or a separate PR (day 2 requirement)

@etherealjoy
Copy link
Contributor Author

etherealjoy commented Jun 14, 2018

Can we also share templates?
Also C++ does not have package name I wonder what to use.

@wing328
Copy link
Member

wing328 commented Jun 14, 2018

Can we also share templates?

Technically yes and that requires changes in the Qt5 client codegen as well.

@wing328
Copy link
Member

wing328 commented Jun 14, 2018

Also C++ does not have package name I wonder what to use.

What about namespace? C++ QT5 client has the following option:

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java#L98

@etherealjoy etherealjoy changed the title [Qt5 Server] WIP Add Support for Qt5 server using QHttpEngine [Qt5 Server] Add Support for Qt5 server using QHttpEngine Jun 16, 2018
Copy link
Contributor

@stkrwork stkrwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not done with reviews, but that what i saw in the java file

* Template Location. This is the location which templates will be read from. The generator
* will use the resource stream to attempt to read the templates.
*/
embeddedTemplateDir = templateDir = "cpp-qt5-server";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't you say there is more than one framework for qt server, which might be interesting to look at? wouldnt it be better then to specifiy which one it is?

Copy link
Contributor Author

@etherealjoy etherealjoy Jul 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add framework information

*/
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"bool",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no char?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

char is not there in OAS

*/
@Override
public String getName() {
return "cpp-qt5-server";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

*/
@Override
public String getHelp() {
return "Generates a Qt5 C++ server library.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with which framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add framework information

@stkrwork
Copy link
Contributor

why close it?

@etherealjoy etherealjoy reopened this Jul 2, 2018
return;
}
if(QStringLiteral("bool").compare(type) == 0) {
bool * val = static_cast<bool*>(value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use qvariant_cast and QVariant here to avoid storing pointers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and sadly the model became complicated :|

@wing328
Copy link
Member

wing328 commented Jul 3, 2018

Hi all, do you think this generator is ready for a beta release?

@etherealjoy
Copy link
Contributor Author

@wing328
@stkrwork wanted to add some comments so I will wait for him.

@wing328
Copy link
Member

wing328 commented Jul 8, 2018

👌 please take your time. I was wondering it's ready for a beta release so as to collect more feedback from the community.

…fy model, add emit signals to default handlers
@etherealjoy
Copy link
Contributor Author

@wing328
We can do a beta and see if we can get feedback.

@wing328 wing328 merged commit 65bad61 into OpenAPITools:master Jul 26, 2018
@etherealjoy etherealjoy deleted the cpp-qt5-server-wip branch July 26, 2018 10:32
@wing328 wing328 added this to the 3.2.0 milestone Jul 26, 2018
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…ls#322)

* Initial wiring to get the QHttpEngine Server running for Qt5 server

* Add wiring for build environment

* Add current generated files

* Update README.md

* Solved Build for Docker and Host
Wired up main
TODO : Route API call to handlers

* Wire up routes

* Wiring up routes update

* Convert Path to QHttpEngine format

* Rename some files

* Extract query Parameters and path parameters

* Removed pri file, Qt can read CMakeLists.txt

* Initial support of deserialization

* Adding initial support for response serialization

* Setup simple signal handler to quite the server with Ctrl+C in a container and on the host

* Remove unneeded function

* Add executable permission to script and move from Debian to Alpine for Dockerfile

* Add stringValue of missing types

* Unify toJson'xxx' APIs the same way like setValue

* Rework to remove all pointer usages, pass by const references, simplify model, add emit signals to default handlers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants