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
  • #2700
Closed
Open
Issue created Apr 19, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

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

Created by: 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

Assignee
Assign to
Time tracking