cpp-restsdk code generation issue for type: string when used as $ref:
Created by: sujayran
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
The issue is the with cpp-restsdk generation basic_string instead of utility::string_t
openapi-generator version
openapi-generator-cli-5.0.0
OpenAPI declaration file content or url
XYZData:
description:
type: object
required:
- events
properties:
events:
type: array
items:
$ref: 'TSxyz.yaml#/components/schemas/Event'
minItems: 1
ids:
type: array
items:
type: string
minItems: 1
aIds:
type: array
items:
type: string
minItems: 1
Event:
type: string
-->
Generation Details
java -Dlog.level=warn -jar openapi-generator-cli-5.0.0.jar generate -g cpp-restsdk -i xyz.yaml -o
Steps to reproduce
java -Dlog.level=warn -jar openapi-generator-cli-5.0.0.jar generate -g cpp-restsdk -i xyz.yaml -o
Related issues/PRs
This is the code generated in .h /// std::vector<std::shared_ptrutility::string_t>& getEvents(); bool eventsIsSet() const; void unsetEvents();
void setEvents(const std::vector<std::shared_ptr<utility::string_t>>& value);
.cpp
if(m_EventsIsSet)
{
val[utility::conversions::to_string_t("Events")] = ModelBase::toJson(m_Events);
}
./../ModelBase.h:184:23: error: no member named 'toJson' in 'std::__cxx11::basic_string' The issue is that it interprets the string as basic_string instead of utility::string_t
Suggest a fix
why can't we just use "basic_string" also $ref adds a shared_ptr even for simple datatype