[BUG][C][cpp-restsdk] Missing Set.h when trying to generate from Twitter OpenAPI JSON
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] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When trying to build C or cpprestsdk APIs generated from Twitter's official OpenAPI JSON, I get missing Set.h and AnyType.h header errors.
openapi-generator version
Latest stable and master offered by official online generators as of time of this bug report.
OpenAPI declaration file content or url
https://api.twitter.com/labs/2/openapi.json as advertised by https://developer.twitter.com/en/docs/labs
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
Someone suggested that maybe I was using the wrong Twitter spec, but I get the same errors from this one: api.twitter.com/2/openapi.json
I suggest to put a [C] in the Issue title.
Looks like the cpp-restsdk client generator doesn't support set at the moment.
We welcome contributions or sponsorships for a fix.
Just hit this issue myself. This change from std::vector needs to be undone completely.
- Set.h and Set are not standard. Was the intent to use
and std::set? - std::set is an ordered container, which comes - there is a lot of overhead to populating one as all data needs to be inserted into a balanced tree. Maybe use std::unordered_set?
- std::unordered_set is not overhead free either.
- std::set and std::unordered_set will change the order of data form the original json. This effect is undesirable.
Please revert to using std::vector
This fix (in need of further testings) seems to allow generation:
https://github.com/OpenAPITools/openapi-generator/compare/master...mlebihan:openapi-generator:cpp-restsdk_Missing_Set_h_9969
@dratchkov I did also a change in cpp-pistache-server to consider the set as a std::set and not a std::vector anymore.