Skip to content

[BUG][C++][Pistache-server] Array of string : The generator omits the "setter" and xxxIsSet() #2700

Open
@CyrilleBenard

Description

@CyrilleBenard

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The generator does generates lots of usual code but the setter of the member variable (std::vectorstd::string type) is not here.

The getter is also "strange" or at least unsual because it returns the reference on the member without the qualification const, so that it may be modified.

Last, the usual function ClassName::memberNameIsSet() is not generated too.

On the opposite, lots of code is well generated and running, for example toJson and fromJson methods (except the the set of the bool variable m_xxxIsSet = true
unsetXXXX() is also well generated.

openapi-generator version

Current master 4.0.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 1.0.0
  title: Check generation of array of object (Pistache)
  description: Internal ref filename is check_array_of_strings.yaml

servers:
  - url: http://localhost:8080

paths:
  /stair1:
    post:
      summary: blabla
      operationId: check_generation
      tags:
        - Stair1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UeContext'
        required: true
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                type: string
        default:
          description: Unexpected error

components:
  schemas:
    UeContext:
      type: object
      properties:
        groups:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          minItems: 0

    ObjectId:
      type: object
      properties:
        events:
          $ref: '#/components/schemas/GroupId'

    GroupId:
      type: string
Command line used for generation

Generate :

openapi-generator-cli.sh generate -i ./openapi.yaml -g cpp-pistache-server -c ./config.json -o .

Compile :

g++ -c  -I./api -I./model -I./impl -Wall -g -std=c++11 -o obj/model/UeContext.o model/UeContext.cpp

Steps to reproduce

Generate & compile

Related issues/PRs

N/A

Suggest a fix

EDIT: See below in the comment please

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