Skip to content

[BUG] [cpp-qt-client] C++ compiler error "'asJsonObject': is not a member of" when pulling enums into schemas #19307

Open
@Knitschi

Description

@Knitschi

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

When I pull the pet status enum in the modules/openapi-generator/src/test/resources/3_0/petstore.json file into the schemas section of the .json file and use the schema in the /pet/findByStatus function and then compile the generated library I get the follwing compiler error:

client\PFXPetApi.cpp(499,48): error C2039: 'asJsonObject': is not a member of 'test_namespace::PFXPetStatus'

The created class PFXPetStatus derives from PFXEnum. Neither provides a asJsonObject() function.

openapi-generator version

7.8.0-20240702.091835-1

OpenAPI declaration file content or url

Here ist the modified petstore.json that reproduces the problem

https://gist.github.com/Knitschi/9c86f1e06dd52c29ee4cdb79ce540fa7

The difference to the original file is that it introduces a schema with the PetStatus enum that is then used in the definition of the /pet/findByStatus function and the Pet schema.

Generation Details

Client was generated with

java -jar openapi-generator-cli-7.8.0-20240702.091835-1.jar generate --input-spec petstore.json --generator-name cpp-qt-client --output . --package-name CppQtPetstoreClient --additional-properties cppNamespace=test_namespace --minimal-update --model-name-prefix PFX 
Steps to reproduce
  • Generate and compile the example samples\client\petstore\cpp-qt with the modified petstore.json file.
Possible Fix

I am not competent enough to provide one.

Related issues/PRs

Maybe this issue is related to: #15277

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