[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:
///
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.