Openapi-generator: [C++][QT5]Basic header file missing for cpp-qt5-client generator

Created on 31 May 2019  路  10Comments  路  Source: OpenAPITools/openapi-generator

We have experienced issues with the creation of the cpp-qt5-client client library.

Upon compilation the compiler errors with the following:

error: OAINumber.h: No such file or directory
 #include "OAINumber.h"

It seems this file is part of the "standard header files" for this generator.
Other header files like OAIObject.h and OAIEnum.h are available and created properly.

It is only OAINumber.h which is nowhere to be found.. The client code has been generated with the latest master branch as of yesterday.

Any help highly appreciated.

C++ Bug C++

Most helpful comment

I got that.

All 10 comments

Please provide the OpenAPI spec/doc so that we can reproduce the issue more easily.

Please make sure you're using the latest stable version (v4.0.0) as well

I'm using the latest version of OpenAPI. It's a very old bug from the swagger days, just google for SWGNumber.h instead of OAINumber.h. I'm not the first to notice.

@lacksfish OAINumber does not occur in the code of openapi-generator and there is no file Number.mustache in https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/cpp-qt5-client, so I guess type: number (https://swagger.io/docs/specification/data-models/data-types/#numbers) is not correctly recognized/mapped to a primitive type in https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5AbstractCodegen.java or https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java.
Since the issue does not occur with https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml (resulting in https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/cpp-qt5/client), probably because it does not contain type: number

cc @ravinikam @stkrwork @etherealjoy @martindelille

@macjohnny
Thanks for the hint. :)

Hm strange, even though I am using the latest master branch, I am still missing the file OAINumber.h in the built client folder after running the generator.. I am definitely using the latest master branch and I've rebuilt with maven after pulling the latest changes...

That is strange. I tested with a number and I dont see it. Do you mind sharing the spec?

I mean, there is references to OAINumber.h in almost every generated file (includes and function params), but the actual file is not there. Unfortunately, I can not share the spec as of now.

  v1.0.WeatherInfo:
    type: object
    description: >-
      Information about the weather at the specified location
    properties:
      wind:
        description: wind conditions at the specified location
        type: object
        properties:
          speed: 
            description: wind speed in current system speed unit
            type: number
            format: double
          direction: 
            description: wind direction in degrees
            type: number
            format: double
/**
 * ContainerApplicationTemplate
 * Container Application Template Description
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

/*
 * OAIV1_0_WeatherInfo_wind.h
 *
 * wind conditions at the specified location
 */

#ifndef OAIV1_0_WeatherInfo_wind_H
#define OAIV1_0_WeatherInfo_wind_H

#include <QJsonObject>



#include "OAIObject.h"
#include "OAIEnum.h"

namespace OpenAPI {

class OAIV1_0_WeatherInfo_wind: public OAIObject {
public:
    OAIV1_0_WeatherInfo_wind();
    OAIV1_0_WeatherInfo_wind(QString json);
    ~OAIV1_0_WeatherInfo_wind() override;

    QString asJson () const override;
    QJsonObject asJsonObject() const override;
    void fromJsonObject(QJsonObject json) override;
    void fromJson(QString jsonString) override;


    double getSpeed() const;
    void setSpeed(const double &speed);


    double getDirection() const;
    void setDirection(const double &direction);



    virtual bool isSet() const override;
    virtual bool isValid() const override;

private:
    void init();

    double speed;
    bool m_speed_isSet;
    bool m_speed_isValid;

    double direction;
    bool m_direction_isSet;
    bool m_direction_isValid;

    };

}

#endif // OAIV1_0_WeatherInfo_wind_H

I got that.

My bad! There's no need for OAINumber.h anymore as all files correctly use double now. Please excuse my oversight!

Thank you so much for your prompt help.
And again I hope you excuse my oversight just now.

Was this page helpful?
0 / 5 - 0 ratings