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

qt5cpp codegen appears wrong for arrays of integers #12256

Open
srcejon opened this issue Oct 25, 2023 · 0 comments
Open

qt5cpp codegen appears wrong for arrays of integers #12256

srcejon opened this issue Oct 25, 2023 · 0 comments

Comments

@srcejon
Copy link

srcejon commented Oct 25, 2023

Description

The qt5cpp code generated for arrays of integers appears incorrect.

java -jar swagger-codegen-cli.jar generate -i Test.yaml -l qt5cpp -o out

definitions:
  Test:
    description: A test case
    properties:
     title:
       type: string
     data:
       type: array
       items:
         type: integer
     data2:
       type: array
       items:
         type: string
     data3:
       type: array
       items:
         type: integer
         format: int64

In this test case, string arrays work OK, but integer and int64 don't.

In generated SWGTest::asJsonObject() method, we get:

    if(data->size() > 0){
        toJsonArray((QList<void*>*)data, obj, "data", "");
    }
    if(data2->size() > 0){
        toJsonArray((QList<void*>*)data2, obj, "data2", "QString");
    }
    if(data3->size() > 0){
        toJsonArray((QList<void*>*)data3, obj, "data3", "");
    }

We can see the last parameter that specifies the inner type is correct for the string array, but not integer or int64.

If I manually change the code to:

    toJsonArray((QList<void*>*)data, obj, "data", "qint32");

And

    toJsonArray((QList<void*>*)data, obj, "data", "qint64");

Then it works.

It seems complexType isn't being substituted correctly.

Swagger-codegen version

2.4.34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant