[cpp-pistache-server] Bug: not generating all files and methods
Created by: mjk4
Description
cpp-pistache-server can generate code which does not compile because it's missing files and methods:
- There are files which have `#include "Object.h"` but no `Object.h` file was generated anywhere.
- `model/AsdfInfo.cpp`'s `AsdfInfo::fromJson` includes a call to `setAttributes` but
no such method was generated for `AsdfInfo`.
openapi-generator version
It's 3.3.4 but I've seen the Object.h issue in 3.3.2 and 3.3.3 though I worked around it temporarily by writing my own Object.h file.
The missing setAttributes
call seems to be new in 3.3.4
OpenAPI declaration file content or url
This is the mini.yaml file that reproduces the issue:
openapi: "3.0.0"
info:
version: "1.0"
title: An API
paths:
/asdfs:
post:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/asdfInfo'
responses:
201:
description: "Created"
content:
application/json:
schema:
type: object
properties:
asdfId:
type: integer
format: int64
components:
schemas:
asdfInfo:
type: object
properties:
attributes:
type: object
Command line used for generation
-
java -version
is:
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
- OS is "CentOS Linux release 7.5.1804 (Core)
- using Apache Maven 3.3.9
Steps to reproduce
Steps:
- Ran
mvn clean package
- Using the newly-created
modules/openapi-generator-cli/target/openapi-generator-cli.jar
- Call it
$JAR
- Call it
- Run
java -jar $JAR generate -i mini.yaml -g cpp-pistache-server -o gen_output
- (mini.yaml is above)
- Look inside gen_output and notice these issues:
- There are files which have
#include "Object.h"
but noObject.h
file was generated anywhere. -
model/AsdfInfo.cpp
'sAsdfInfo::fromJson
includes a call tosetAttributes
but no such method was generated forAsdfInfo
.
- There are files which have