[C++][cpp-restsdk] (Type string - format binary) are not well handled - compilation failed
Created by: CyrilleBenard
Description
This bug issue is almost the same than the one I identified for Pistache server, see #638 (closed) For convenience, I decided to create a dedicated cpp-restsdk bug issue.
The compilation error looks like :
./client-ms2/gen-cpp/model/Body.cpp: In member function ‘virtual web::json::value com::bcom::amf::microservice::client::ms2::model::Body::toJson() const’:
./client-ms2/gen-cpp/model/Body.cpp:44:120: error: no matching function for call to ‘com::bcom::amf::microservice::client::ms2::model::Body::toJson(const com::bcom::amf::microservice::client::ms2::model::HttpContent&) const’
ty::conversions::to_string_t("binaryDataN2Information")] = ModelBase::toJson(m_BinaryDataN2Information);
^
openapi-generator version
Current master 3.2.3-SNAPSHOT
OpenAPI declaration file content or url
openapi: "3.0.0"
info:
version: 1.0.0
title: Check wrong generation of a body containing string/binary type
description: Internal ref filename is check_binary_property.yaml
servers:
- url: http://localhost:8080
paths:
/check:
post:
summary: see title
tags:
- Non UE N2 Message Transfer
operationId: NonUeN2MessageTransfer
requestBody:
content:
application/json:
schema:
type: object
properties: # Request parts
binaryDataN2Information:
type: string
format: binary
required: true
responses:
'200':
description: Non UE N2 Message Transfer successfully initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/content'
default:
description: Unexpected error
components:
schemas:
Bytes:
format: byte
type: string
Content:
type: object
properties:
type:
$ref: '#/components/schemas/Bytes'
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Check wrong generation of a body containing string/binary type",
"description": "Internal ref filename is check_binary_property.yaml"
},
"servers": [
{
"url": "http://localhost:8080"
}
],
"paths": {
"/check": {
"post": {
"summary": "see title",
"tags": [
"Non UE N2 Message Transfer"
],
"operationId": "NonUeN2MessageTransfer",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"binaryDataN2Information": {
"type": "string",
"format": "binary"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Non UE N2 Message Transfer successfully initiated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/content"
}
}
}
},
"default": {
"description": "Unexpected error"
}
}
}
}
},
"components": {
"schemas": {
"Bytes": {
"format": "byte",
"type": "string"
},
"Content": {
"type": "object",
"properties": {
"type": {
"$ref": "#/components/schemas/Bytes"
}
}
}
}
}
}
Command line used for generation
Generate :
openapi-generator-cli.sh generate -i ./openapi.yaml -g cpp-restsdk -c ./config.json -o gen-cpp
Compile :
mkdir -p obj ; cd obj ; cmake -D CPPREST_ROOT=/usr/ ../gen-cpp ; make ; cd ..
Steps to reproduce
Generate & Compile
Related issues/PRs
Suggest a fix/enhancement
Maybe a similar code than suggested (for the same method) in #638 (closed)