Skip to content

[BUG][Qt] Generating code from API with bool properties called valid leads to non-compilable code #17487

@martonmiklos

Description

@martonmiklos

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version
OpenAPI declaration file content or url

https://demo.inventree.org/api/schema/

It is a demo site, could be accessed with the credentials listed here:
https://inventree.org/demo.html

The following section for e.g.:

    PatchedBomItemValidation:
      type: object
      description: Simple serializer for passing a single boolean field
      properties:
        valid:
          type: boolean
          default: false

generates to the following C++ code:

    bool isValid() const;
    void setValid(const bool &valid);
    bool is_valid_Set() const;
    bool is_valid_Valid() const;

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

The last two overridden functions are generated for each class derived from Objects which conflicts with the generated ones.

The problem transitive to the bool properties called set I think.

Suggest a fix

Suffix the conflicting generated method names with an underscore (isValid_(), isSet_())

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions