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
  • #3769
Closed
Open
Issue created Aug 27, 2019 by Administrator@rootContributor0 of 1 checklist item completed0/1 checklist item

[BUG] No setter function generated for arrays

Created by: julesdent

Bug Report Checklist

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

No setter function is generated for an array.

openapi-generator version

4.1.1

OpenAPI declaration file content or url
openapi: 3.0.0
servers:
  - description: SwaggerHub API Auto Mocking
    url: 'https://virtserver.swaggerhub.com/'
info:
  description: API
  version: 1.0.1
  title: API
  termsOfService: 'http://swagger.io/terms/'
tags:
  - name: FuelCosts
paths:
  '/FuelCosts':
    get:
      description: Obtain fuel costs
      tags:
        - FuelCosts
      summary: Get fuel cost
      operationId: GetFuelCostQuery
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FuelCost'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    FuelCost:
      type: object
      properties:
        Remarks:
          type: array
          items:
            type: string
Command line used for generation

java -jar openapi-generator-cli-4.1.1.jar generate -i ./Bug.json -g cpp-pistache-server -o generated

Steps to reproduce

Generate the C++ code from the spec. In the generated FuelCost.h, there is a getter function for Remarks but no setter: ///

/// /// std::vectorstd::string& getRemarks(); bool remarksIsSet() const; void unsetRemarks();

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/3271

Suggest a fix

As a workaround, you can derive a class from FuelCost and add a setter function manually, but this should really be handled by the generator.

Assignee
Assign to
Time tracking