OpenAPITools / OpenAPITools/openapi-generator

[BUG] [C] Generating C client undefined `object.h` in

Open
#2,338 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist

ll/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 (editor.swagger)
Description

I am trying to compile the library generated using openapi-generator with the past command, because this is what i need for my project, not use directly the files.
I try with other specs and i don't have any problem, is just with mine, and is only in C, because i try library generated in CSharp and Python and work very well.

openapi-generator version

@openapitools/openapi-generator-cli@cli-3.3.4

OpenAPI declaration file content or url

You can find the yml we create in the next address:
https://gist.github.com/stdevMac/2df88707fbbe652424cc35e043be828b

Command line used for generation
$ openapi-generator generate -g c --additional-properties=prependFormOrBodyParameters=true -o ./c_swagger -i ./swagger.yml
Steps to reproduce

Just run this after follow all the steps in generated README.md

$ gcc $(find . -name '*.c')  -I ./model -I ./include -I ./external/include -o p.out -lcurl 
In file included from ./api/DefaultAPI.c:15:0:
./model/inline_response_200_7.h:13:10: fatal error: object.h: No such file or directory
 #include "object.h"
          ^~~~~~~~~~
compilation terminated.
In file included from ./model/inline_response_200_7.c:7:0:
./model/inline_response_200_7.h:13:10: fatal error: object.h: No such file or directory
 #include "object.h"
          ^~~~~~~~~~
compilation terminated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Generate the C client from the linked swagger.yml with the stated openapi-generator command, then follow the generated README.md and compile the files under api, model, include, and external/include. Start with model/inline_response_200_7.h and its corresponding .c file; done means the generated client no longer fails because object.h is missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, openapi
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.