OpenAPITools / OpenAPITools/openapi-generator

[BUG][dart-dio] syntax error stopping build_runner from completing

Open
#12,306 7 comments 2 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

dart-dio fails to generate the Twitter v2 API spec. The outputted code has syntax errors that does not allow build_runner to generate the final pieces of code

https://api.twitter.com/2/openapi.json

openapi.json.zip

openapi-generator-cli 5.4.0
  commit : 4a36be7
  built  : 2022-01-31T05:31:36Z
  source : https://github.com/openapitools/openapi-generator
  docs   : https://openapi-generator.tech/
openapi-generator generate -i spec.json -g dart-dio -o dart_dio_client
cd dart_dio_client
dart pub get
dart run build_runner build --delete-conflicting-outputs
[SEVERE] built_value_generator:built_value on test/spaces_api_test.dart:

Bad state: Unexpected diagnostics:
/Users/lukepighetti/development/flutter/flutter/bin/cache/dart-sdk/lib/core/int.dart:167:18 - Operator declarations must be preceded by the keyword 'operator'.
/Users/lukepighetti/development/flutter/flutter/bin/cache/dart-sdk/lib/core/int.dart:167:16 - Methods must have an explicit list of parameters.
/Users/lukepighetti/development/flutter/flutter/bin/cache/dart-sdk/lib/core/int.dart:167:18 - A function body must be provided.

Related to:

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 generation using the linked openapi.json and the dart-dio command, then run dart run build_runner build --delete-conflicting-outputs in the generated client. Start with the generated code referenced by test/spaces_api_test.dart and the reported int.dart diagnostics; done means the Twitter v2 client builds without the syntax errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, openapi
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.