Skip to content

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

Closed

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_())

Activity

  1. added a commit that references this issue on Jan 25, 2024
    5db2be0
  2. added a commit that references this issue on Feb 6, 2024
    aefea01
  3. added a commit that references this issue on Feb 8, 2024
    36f2eca
  4. added a commit that references this issue on Feb 10, 2024
    774e7eb
  5. added a commit that references this issue on Feb 23, 2024
    9070c07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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