-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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] Improvement in response handling #675
[qt5 server] Improvement in response handling #675
Conversation
socket->writeHeaders();{{#returnType}}{{^isPrimitiveType}} | ||
QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).to{{^isListContainer}}Object{{/isListContainer}}{{#isListContainer}}Array{{/isListContainer}}());{{/isPrimitiveType}} | ||
socket->writeJson(resDoc);{{#isPrimitiveType}} | ||
socket->write(::{{cppNamespace}}::toStringValue(res).toUtf8());{{/isPrimitiveType}}{{/returnType}}{{^returnType}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For restbed i used json arrays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for json arrays it is OK, I mean if the response is array or map of primitive types.
Beccause they are arrays/maps of strings , how do we indicate it is an array instead of a long string. How is this defined in spec?
@wing328 @stkrwork
|
@etherealjoy can you please give an example to illustrate the problem? |
swagger: '2.0'
info:
title: Test
version: v1.0
basePath: /
schemes:
- http
paths:
/endpoints/{pathpar1}/{pathpar2}:
get:
produces:
- text/string
parameters:
- name: pathpar1
required: true
in: path
type: string
- name: pathpar2
required: true
in: path
type: string
responses:
'200':
description: Success
schema:
type: array
items:
type: string
'400':
description: Bad Request
schema:
type: string I have no idea how the string would look like for this response. |
It should be something like:
|
@wing328 |
@etherealjoy right. Map/Dictionary/Hash is "type: object" |
I will add support for multiple path params in a later PR. |
* Remove warnings and add custom request sending * Remove duplicate code from subclass and add missing setupRoutes * Removed redundant override * Add serialization of responses * Fix CI failure * Add inline function to duplicate code. * Make const reference wherever possible * Add support for Array of Primitive types. * Add Array of Primitive support for Error response * Update for multiple path params
PR checklist
./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\
.master
,4.0.x
. Default:master
.Description of the PR
const
and const reference where applicable@stkrwork @MartinDelille