Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [cpp-qt5] Array of files generates a solution not compilable #9307

Open
Mariolismo opened this issue Apr 21, 2021 · 0 comments
Open

[BUG] [cpp-qt5] Array of files generates a solution not compilable #9307

Mariolismo opened this issue Apr 21, 2021 · 0 comments

Comments

@Mariolismo
Copy link

Mariolismo commented Apr 21, 2021

Description

The auto-generated code doesn't compile (after running CMake to generate the solution).
The problem seems to be related to this part of the YAML:

  file:                  
  type: array
  items:
    type: string
    format: binary

This is an array of files, inside the cpp-qt5 generated code is declared as a ::OpenAPI::OptionalParam<QList<OAIHttpFileElement>> &file but than is accessed like if it was a single element: file.value().local_filename, causing the compilation to fail.

openapi-generator version

5.1.0

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Processing Service
  version: 1.0.0
servers:
  - url: 'http://localhost:8080'
    description: Processing Service (Aresys GRAPeS Library)
paths:
  '/api/companies/{companyId}/mask':
    post:
      tags:
        - maskEndpoint
      operationId: uploadMask
      parameters:
        - name: companyId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                mask:
                  $ref: '#/components/schemas/MaskInfo'
                file:
                  type: array
                  items:
                    type: string
                    format: binary
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: string
  
components:
  schemas:
    MaskInfo:
      required:
        - maskId
        - timestamp
      type: object
      properties:
        maskId:
          type: array
          items:
            type: string
        timestamp:
          type: string
          format: date-time
Command line used for generation

java -DskipFormModel=false -jar openapi-generator-cli-5.1.0.jar generate -i openapi.yaml -g cpp-qt5-client -o qt5

Steps to reproduce
  1. Execute the command in the folder containing the YAML file and the openapi-generator-cli-5.1.0.jar
  2. Execute cmake client
  3. Open the vs solution "client.sln" and rebuild
Related issues/PRs

Seems to be similar to: #3271

Suggest a fix/enhancement

The problem seems to happen only with cpp-qt5, since using SPRING the generators handles correcly the resulting list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant