OpenAPITools / OpenAPITools/openapi-generator

[BUG][C] The bundled cJSON is an old version, and it should be a library dependency anyway

Open
#20,431 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently cJSON is just a copy of the v1.7.7 sources (with a few typo fixes in comments). It's old (2018) and not used like a library dependency really should. It should be dynamically linked like is already done with OpenSSL and libcurl.

Word diff of upstream cJSON v1.7.7 and openapi-generator's bundled copy:

Screenshot_20250109-210912~3

Here's the script from the screenshot:

#!/usr/bin/env bash

domain='https://raw.githubusercontent.com'
a="$domain/DaveGamble/cJSON/refs/tags/v1.7.7"
b="$domain/OpenAPITools/openapi-generator/refs/heads/master"
b+='/modules/openapi-generator/src/main/resources/C-libcurl'

for f in cJSON.{c,h}; do
  printf -vx "%0${#f}d"
  x="+-${x//0/-}-+"
  printf "\n$x\n| %s |\n$x\n" "$f"
  git diff -U0 --no-index --color=always --color-words \
      <(curl "$a/$f" -s) <(curl "$b/$f.mustache" -s) \
  | tail -n+4
done

echo

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

Start in modules/openapi-generator/src/main/resources/C-libcurl, where the bundled cJSON sources are represented by cJSON.c.mustache and cJSON.h.mustache. Compare how OpenSSL and libcurl are handled as library dependencies, then inspect the generated C client build setup. Done means cJSON is no longer bundled and generated clients link it dynamically like the other external libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.