Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8410
Closed
Open
Issue created Jan 11, 2021 by Administrator@rootContributor

[REQ][Qt][C++] Callback support for Qt5

Created by: basyskom-dege

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&#x3D;&#39;{
  &quot;description&quot; : &quot;subscription payload&quot;,
  &quot;content&quot; : {
    &quot;application/json&quot; : {
      &quot;schema&quot; : {
        &quot;properties&quot; : {
          &quot;timestamp&quot; : {
            &quot;type&quot; : &quot;string&quot;,
            &quot;format&quot; : &quot;date-time&quot;
          },
          &quot;userData&quot; : {
            &quot;type&quot; : &quot;string&quot;
          }
        }
      }

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!

Assignee
Assign to
Time tracking