Description
Is your feature request related to a problem? Please describe.
I would like to add callback support for Qt5. I started to implement it but i came across a problem i could not solve.
As far is I know, the callback URL has to be put in the query and if it requires parameters in the request body, those parameters have to be put in the body. I can retrieve the callback URL but i cant get the parameters for the body in the mustache template. I am using THIS YAML file. I tried to change the AbstractCppCodegen.java
to create a new Mustache variable (line 339f.):
public void preprocessOpenAPI(OpenAPI openAPI) {
List<Server> serverList = openAPI.getServers();
Map<String, Callback> callbacks = openAPI.getComponents().getCallbacks();
(...)
this.additionalProperties.put("test", callbacks);
}
Unfortunatly this will result in an empty map even though the YAML file proviedes callbacks.
Only way I could get the callback is to use {{#callbacks}}
inside {{#operations}}
. This is where i can get the callback URL but I cant get the parameters, since they are defined in jsonSchma
, which is a big string with the whole request body:
jsonSchema='{
"description" : "subscription payload",
"content" : {
"application/json" : {
"schema" : {
"properties" : {
"timestamp" : {
"type" : "string",
"format" : "date-time"
},
"userData" : {
"type" : "string"
}
}
}
The parameters from the callbacks are defined in the callbacks
section of the YAML file:
callbacks:
onData:
'{$request.query.callbackUrl}/data':
post:
requestBody:
description: subscription payload
content:
application/json:
schema:
properties:
timestamp:
type: string
format: date-time
userData:
type: string
Does anyone knows how to get the single parameters from the requestBody
field without the big string?
Thanks in advance!