OpenAPITools / OpenAPITools/openapi-generator

[C++] Using generated QT Client: How to know which response corresponds to which request?

Open
#18,878 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I have used the qt client generator for C++. I am using the generated api to make the request and connecting the the corresponding signal to obtain the response but as I have a lot of requests I need to find the way to know which response is the corresponding one to each request.

The definition of the request is the following one:

/object:
    post:
      operationId: addObject
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Object'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectId'          
        '400':
          description: Bad Request - Invalid input

the way I connect the signal is the following:

connect(&openApi_, &OpenAPI::Object::addObjectSignalFull, this,
            &addObjectSignalFull);

So I when I do the request:

openApi_.addObject(object1);
openApi_.addObject(object2);
openApi_.addObject(object3);

and I receive:

addObjectSignalEFull(worker, objectId_A);
addObjectSignalEFull(worker, objectId_B);
addObjectSignalEFull(worker, objectId_C);

how can I know to which object (object1, object2 o object3) corresponds, for example, the objectId_B

I will appreciate any help you can provide me.

Kindest regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the Qt C++ generator templates or generated signal declarations for addObject and trace how concurrent calls are represented. Define and verify a way to associate each response with its request, then exercise three concurrent addObject calls; the issue provides no test path or named source file.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.