Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8456
Closed
Open
Issue created Jan 15, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

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

Assignee
Assign to
Time tracking