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
  • #6014
Closed
Open
Issue created Apr 22, 2020 by Administrator@rootContributor

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

Created by: ChrisAfaik

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).

Assignee
Assign to
Time tracking