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
  • #5395
Closed
Open
Issue created Feb 21, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] generated code crashes with additionalParameters label:"Client: C"

Created by: michelealbano

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I used the following code, and the compiled program crashed (I didn't expect "Segmentation fault (core dumped)")

`#include "../api/DefaultAPI.h"

int main(int argc, char** argv) {

list_t* orchestration_flags = list_create(); list_addElement(orchestration_flags, keyValuePair_create("onlyPreferred", false)); list_addElement(orchestration_flags, keyValuePair_create("overrideStore", (void*)true));

orchestration_form_request_dto_t* request_form = orchestration_form_request_dto_create(orchestration_flags);

printf("request:\n%s\n",cJSON_Print(orchestration_form_request_dto_convertToJSON(request_form)));

return 0; } `

openapi-generator version

Current Master from today 21/02/2020

OpenAPI declaration file content or url
openapi: 3.0.2
info:
  title: Additional parameters
  contact:
    name: Michele Albano, Arrowhead Consortia
    email: mialb@cs.aau.dk
  version: 4.1.3
paths:
  /orchestrator/orchestration:
    post:
      summary: Start Orchestration process.
      operationId: orchestrationProcessUsingPOST
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrchestrationFormRequestDTO"
        description: request
        required: true
      responses:
        "200":
          description: Returns possible providers of the specified service.
      deprecated: false
servers:
  - url: 'http://192.168.115.4:8441/'
    description: Test server
components:
  schemas:
    OrchestrationFormRequestDTO:
      type: object
      properties:
        orchestrationFlags:
          type: object
          additionalProperties:
            type: boolean
      title: OrchestrationFormRequestDTO
Command line used for generation

java -jar /mnt/hgfs/shared/deliver-openapi/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i /mnt/hgfs/shared/ahAddit.yaml -g c

Steps to reproduce

mkdir build cd build cmake .. make cp /home/michele/mainAddit.c . gcc mainAddit.c -I. -L. -ladditional_parameters export LD_LIBRARY_PATH=. ./a.out

Result: I didn't expect "Segmentation fault (core dumped)"

Related issues/PRs
Suggest a fix

Using gdb, I found out that the generated code has a circular dependency. I am providing a PR to solve the issue.

Assignee
Assign to
Time tracking