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
  • #7542
Closed
Open
Issue created Sep 29, 2020 by Administrator@rootContributor

[cpp-restsdk]How to write the API request in Open API to get response in UTF8 string instead of wide string without using any redundant type conversion

Created by: himadree-shekhar

Description

I want to write an API in OpenAPI so that the generated API function can return JSON response in UTF8 encoding. but it only returns in string_t wide string. i check the C++ code definition of the generated function : The generated function returns wstring by web::http::http_response.extract_string( ) But instead i want to return std:string using web::http::http_response.extract_utf8string();

I know that there is a cpp-restsdk library function conversions::to_utf8string( ) to convert wide string to std::string. but i want to skip such data conversion function when I can directly get data in actual UTF8 using extract_utf8string.

openapi-generator version 4.3.1
OpenAPI declaration file content or url
/api/v1/user/items:
    get:
      tags:
        - test
      summary: Get list.
      description: Returns list.
      operationId: getList
      responses:
        '200':
          description: Returns JSON array.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
Command line used for generation

npx @openapitools/openapi-generator-cli generate -i test.yaml -g cpp-restsdk -o %CD%

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Assignee
Assign to
Time tracking