Skip to content

[BUG] C code does not compile when array in a form label:"Client C" #5623

Closed
@michelealbano

Description

@michelealbano

Bug Report Checklist

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

When I create a C client for a YAML containing a form with an array, the code of the library does not compile:

[ 14%] Building C object CMakeFiles/skycoin_rest_api/.dir/api/DefaultAPI.c.o
In file included from /path/to/stuff/api/DefaultAPI.c:4:
/path/to/stuff/api/DefaultAPI.h:13:69: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
13 | DefaultAPI_walletTransaction(apiClient_t *apiClient ,list_t list_t * to);
| ^
/path/to/stuff/api/DefaultAPI.c:17:69: error: expected ‘;’, ‘,’ or ‘)’ before ‘
’ token
17 | DefaultAPI_walletTransaction(apiClient_t *apiClient ,list_t *list_t * to)
| ^
make[2]: *** [CMakeFiles/skycoin_rest_api/.dir/build.make:128: CMakeFiles/skycoin_rest_api/.dir/api/DefaultAPI.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/skycoin_rest_api/.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

openapi-generator version

Current master.

OpenAPI declaration file content or url

https://gist.github.com/michelealbano/c7ef72864f8e4241e8478ab996a5a510

The yaml is a simplification of the one in issue #2338

Command line used for generation

java -jar /path/to/openapi-generator-cli.jar generate -g c -i /path/to/arrayinform.yaml

Steps to reproduce
mkdir build
cd build
cmake ..
make
Related issues/PRs

The yaml is a simplification of the one in issue #2338

Suggest a fix

I did a run with -DdebugOperations. I then analyzed api-body.mustache and api-header.mustache.

Need to solve the fact that the array activates both {{^isPrimitiveType}} and {{#isListContainer}}.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions