Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][C][cpp-restsdk] Missing Set.h when trying to generate from Twitter OpenAPI JSON #9969

Open
5 of 6 tasks
HunterZ opened this issue Jul 18, 2021 · 5 comments
Open
5 of 6 tasks

Comments

@HunterZ
Copy link

HunterZ commented Jul 18, 2021

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • 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
@HunterZ HunterZ changed the title [BUG] Missing Set.h when trying to generate from Twitter YAML [BUG] Missing Set.h when trying to generate from Twitter OpenAPI JSON Jul 18, 2021
@HunterZ
Copy link
Author

HunterZ commented Jul 18, 2021

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

@IARI
Copy link

IARI commented Jul 25, 2021

I suggest to put a [C] in the Issue title.

@HunterZ HunterZ changed the title [BUG] Missing Set.h when trying to generate from Twitter OpenAPI JSON [BUG][C][cpp-restsdk] Missing Set.h when trying to generate from Twitter OpenAPI JSON Jul 26, 2021
@wing328
Copy link
Member

wing328 commented Aug 1, 2021

Looks like the cpp-restsdk client generator doesn't support set at the moment.

We welcome contributions or sponsorships for a fix.

@dratchkov
Copy link

Just hit this issue myself.
This change from std::vector needs to be undone completely.

  1. Set.h and Set are not standard. Was the intent to use and std::set?
  2. 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?
  3. std::unordered_set is not overhead free either.
  4. 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

mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 7, 2024
    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
    - Handling `std::set` in cpp-restdsk
    - [[BUG][C][cpp-restsdk] Missing Set.h when trying to generate from Twitter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969)
@mlebihan
Copy link
Contributor

mlebihan commented May 7, 2024

This fix (in need of further testings) seems to allow generation:
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.

mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 10, 2024
…tter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969)

    - Handling `std::set` in cpp-restdsk

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 10, 2024
…tter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969)

    - Handling `std::set` in cpp-restdsk

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 14, 2024
…tter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969)

    - Handling `std::set` in cpp-restdsk

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 15, 2024
…tter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969)

    - Handling `std::set` in cpp-restdsk
    - Member variables using `std:set` added to `Pet` in cpp-restsdk 3.0 Petstore sample

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
wing328 pushed a commit that referenced this issue May 15, 2024
…tter OpenAPI JSON #9969](#9969) (#18631)

- Handling `std::set` in cpp-restdsk
    - Member variables using `std:set` added to `Pet` in cpp-restsdk 3.0 Petstore sample

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
renatomameli pushed a commit to renatomameli/openapi-generator that referenced this issue May 17, 2024
…tter OpenAPI JSON OpenAPITools#9969](OpenAPITools#9969) (OpenAPITools#18631)

- Handling `std::set` in cpp-restdsk
    - Member variables using `std:set` added to `Pet` in cpp-restsdk 3.0 Petstore sample

[cpp-pistache-server] taking into account a remark on this issue about cpp-pistache-server and its set management

    - Switching `std::vector` to `std::set` for openapi set type in cpp-pistache-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants