Skip to content

[REQ] [C++] [Qt5] [Client] Expose presence of optional elements #6014

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

Closed
ChrisAfaik opened this issue Apr 22, 2020 · 0 comments · Fixed by #6020
Closed

[REQ] [C++] [Qt5] [Client] Expose presence of optional elements #6014

ChrisAfaik opened this issue Apr 22, 2020 · 0 comments · Fixed by #6020

Comments

@ChrisAfaik
Copy link

Currently it's not possible to detect the presence of optional model properties. It seems to me to be a relevant use case when dealing with responses, particularly.

Example:

Given the API specification

openapi: 3.0.0
info:
  description: Example
  version: "1.0.0"
  title: Example
servers:
  - url: http://localhost/
paths:
  /example/:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/complex-response'

components:
  schemas:
    complex-response:
      type: object
      properties:
        property1:
          type: string
          format: string
        property2:
          type: integer
          format: int32
      required:
        - property1
        #- property2

a model class will be generated like

class OAIComplex_response : public OAIObject {
    ...
private:
    ...
    QString property1;
    bool m_property1_isSet;
    bool m_property1_isValid;

    qint32 property2;
    bool m_property2_isSet;
    bool m_property2_isValid;
};

I think the <ModelClass>::m_<PropertyName>_isSet members should be exposed by public getters.

This change only relates to C++ Qt5 client generator (cpp-qt5-client).

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

Successfully merging a pull request may close this issue.

2 participants