OpenAPITools / OpenAPITools/openapi-generator

[BUG] [C Client] replacement list_t to set_t

Open
#6,519 0 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

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

After last C Client updating and generate model by my json,
observe that list_t was change on set_t.
I'm not sure but looks that this "set_t" header also should to be in includes?

NEW MODEL GEN:
#include "set.h"
....
typedef struct location_data_t {
set_t *present_data; //primitive container
struct location_geo_ref_t *geo; //model
struct location_nds_tile_ref_t *tile; //model

} location_data_t;

location_data_t *location_data_create(
set_t *present_data,
location_geo_ref_t *geo,
location_nds_tile_ref_t *tile
);

OLD MODEL GEN:
typedef struct location_data_t {
list_t *present_data; //primitive container
struct location_geo_ref_t *geo; //model
struct location_nds_tile_ref_t *tile; //model

} location_data_t;

location_data_t *location_data_create(
list_t *present_data,
location_geo_ref_t *geo,
location_nds_tile_ref_t *tile
);

openapi-generator version

openapi-generator-cli 5.0.0-SNAPSHOT
commit : f91a5f7
built : 2020-06-01T16:49:51+03:00
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/

OpenAPI declaration file content or url

"LocationGeoRef": {
"type": "object",
"properties": {
"lat": {
"maximum": 90,
"minimum": -90,
"type": "number"
},
"lon": {
"maximum": 180,
"minimum": -180,
"type": "number"
}
},
"required": [
"lat",
"lon"
]
},
"LocationNDSTileRef": {
"type": "object",
"properties": {
"level": {
"maximum": 15,
"minimum": 0,
"type": "integer"
},
"id": {
"type": "string"
}
},
"required": [
"level",
"id"
]
},
"LocationData": {
"type": "object",
"properties": {
"presentData": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"GEO",
"TILE"
]
}
},
"geo": {
"$ref": "#/components/schemas/LocationGeoRef"
},
"tile": {
"$ref": "#/components/schemas/LocationNDSTileRef"
}
}
}
}

Command line used for generation

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ~/test/api-spec.json -g c -o ~/test/evtLOG_gen

Steps to reproduce
Related issues/PRs
Suggest a fix

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

Reproduce the C client generation with the openapi-generator-cli.jar command and the provided LocationData schema. Start by tracing the C generator entry point and its generated model output, then compare the set_t and list_t declarations and includes. Done means the generated C model uses the intended container type consistently and includes the required header.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.