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
  • #934
Closed
Open
Issue created Aug 30, 2018 by Administrator@rootContributor

[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

#638 (closed)

Suggest a fix/enhancement

Maybe a similar code than suggested (for the same method) in #638 (closed)

Assignee
Assign to
Time tracking