Skip to content

[BUG][C++][Pistache][Restbed] Array of objects does not generate model file #3271

Open
@muttleyxd

Description

@muttleyxd

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

Actual:
When declaring array of objects (which have properties), model is not generated.
It will result in Object.h include missing for cpp-restbed-server and cpp-pistache-server

Expected:
model/ProblematicArrayType.h (and .cpp) are created

openapi-generator version

4.0.2

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  description: Some description
  version: 0.0.1
  title: Some title

tags:
  - name: hello

paths:
  "/there":
    get:
      operationId: helloThereGet
      tags:
        - hello
      summary: Do something
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProblematicArrayType"
servers:
  - url: http://localhost:8080
components:
  schemas:
    ProblematicArrayType:
      type: array
      items:
        type: object
        properties:
          someint:
            type: integer
            format: int32
          somestring:
            type: string
Command line used for generation

openapi-generator-cli generate -i problem.yaml -g cpp-pistache-server -o generated_pistache
openapi-generator-cli generate -i problem.yaml -g cpp-restbed-server -o generated_restbed

Steps to reproduce
openapi-generator-cli generate -i problem.yaml -g cpp-pistache-server -o generated_pistache
cd generated_pistache
mkdir build
cd build
cmake ..
make -j4
Related issues/PRs

#2769 #1827 #1637

Suggest a fix

No idea how to fix it, but the issue happens both on Pistache and Restbed

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