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

Impossible to create Dart client with Github spec #7850

Open
chemaxa opened this issue Oct 31, 2020 · 8 comments
Open

Impossible to create Dart client with Github spec #7850

chemaxa opened this issue Oct 31, 2020 · 8 comments

Comments

@chemaxa
Copy link

chemaxa commented Oct 31, 2020

Description

Hi. I am tried to use OpenApitools and https://editor.swagger.io/ online generators for build dart github api client, but no one of them cant build working code.

openapi-generator version

5.0.0-beta2

OpenAPI declaration file content or url

https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com

Command line used for generation

I tried using online generator on https://editor.swagger.io/,
just put URL on github json spec file and select DART in dropdown menu.

After that i also try to use openapi tools generator and download jar and used command from
https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO

java -jar .\openapi-generator-cli-5.0.0-beta2.jar generate -i .\openapi.json -g dart -o .\dart-client

Where openapi.json file i getting from https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com

Steps to reproduce

Just try to build client from github swagger.json, and open code editor, after analyze is finished dart compiler will show all issues with generated code.

@auto-labeler
Copy link

auto-labeler bot commented Oct 31, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@kuhnroyal
Copy link
Contributor

Can you specify the problems that occur?

@kuhnroyal
Copy link
Contributor

@chemaxa It would be great if you can run this again with 5.0.0 and describe the specific problems that you are having.

@chemaxa
Copy link
Author

chemaxa commented Dec 22, 2020

Unfortunately it doesnt work with github spec.

2020-12-22_16-51-27

More than 7k errors in generated code.

@kuhnroyal
Copy link
Contributor

They seem to use a lot of plain objects, that is an issue that is tracked here: #8179
For the other errors like Expected to find ';' and Expected an identifier we need more specifics.

@robrbecker
Copy link

@chemaxa I'm looking to convert https://github.com/SpinlockLabs/github.dart to be generated via the openapi spec if you'd like to help. discussion here SpinlockLabs/github.dart#245

@robrbecker
Copy link

The main problems I'm still getting are

  • a lot of InlineObject### classes.
  • Class OneOfintegerstring isn't found.
  • Doesn't generate a dart 2.12 null-safe api

@xmo-odoo
Copy link

xmo-odoo commented Nov 22, 2021

Figuring this is mostly an issue with Github's spec so posting it here: using 5.3.0, generating a Rust project from the github OpenAPI spec

  • generates pages after pages of warnings including
    • Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
    • The following schema has undefined (null) baseType.
  • once that finishes, the generated project has 282 compilation errors:
    • duplicated fields _1
    • numerous instances of UNKNOWN_BASE_TYPE not found
    • odd composite types not found (e.g. OneOfstringinteger, OneOfstringobject, AnyOfsimpleUserteam)
    • type mismatches (e.g. Box<Option<_>> being passed where Option<Box<_>> is expected)
    • Default declaration missing on various structures leading to their parent structures being unable to declare Default

Also probably more specific to the rust generator: every field is associated with rename_all even when that's not necessary (which is "generally").

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

4 participants