Skip to content
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

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

Closed
5 of 6 tasks
martonmiklos opened this issue Dec 28, 2023 · 0 comments · Fixed by #17722
Closed
5 of 6 tasks

Comments

@martonmiklos
Copy link
Contributor

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

martonmiklos added a commit to martonmiklos/openapi-generator that referenced this issue Jan 25, 2024
 - signals (builtin Qt macro)
 - slots (builtin Qt macro)
 - NULL
 - valid (generated classes has an isValid method)
 - set (generated classes has an isSet method)

Fixes OpenAPITools#17487
martonmiklos added a commit to martonmiklos/openapi-generator that referenced this issue Feb 6, 2024
 - signals (builtin Qt macro)
 - slots (builtin Qt macro)
 - valid (generated classes has an isValid method)
 - set (generated classes has an isSet method)

Fixes OpenAPITools#17487
wing328 pushed a commit that referenced this issue Feb 8, 2024
#17722)

- signals (builtin Qt macro)
 - slots (builtin Qt macro)
 - valid (generated classes has an isValid method)
 - set (generated classes has an isSet method)

Fixes #17487
martonmiklos added a commit to martonmiklos/openapi-generator that referenced this issue Feb 10, 2024
 - signals (builtin Qt macro)
 - slots (builtin Qt macro)
 - valid (generated classes has an isValid method)
 - set (generated classes has an isSet method)

Fixes OpenAPITools#17487
kota65535 pushed a commit to kota65535/openapi-generator that referenced this issue Feb 23, 2024
OpenAPITools#17722)

- signals (builtin Qt macro)
 - slots (builtin Qt macro)
 - valid (generated classes has an isValid method)
 - set (generated classes has an isSet method)

Fixes OpenAPITools#17487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant