swagger-api / swagger-api/swagger-codegen

[Dart] deprecated dart 2 code generated

Open
#8,353 1 comment 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The generated dart code contains deprecations in dart 2. It should be possible to generate code without deprecation warnings. Generating valid dart 1 code should be possible as well.

Swagger-codegen version

2.4.0

Swagger declaration file content or url

http://petstore.swagger.io/v2/swagger.json

Command line used for generation

./bin/dart-petstore.sh

Steps to reproduce
  • cd samples/client/petstore/dart/flutter_petstore
  • flutter analyze

info • The name of the analysis options file .analysis_options is deprecated; consider renaming it to
analysis_options.yaml • swagger/.analysis_options:1:1
info • 'JSON' is deprecated and shouldn't be used • swagger/lib/api_client.dart:85:23
info • 'JSON' is deprecated and shouldn't be used • swagger/lib/api_client.dart:94:20
info • 'BASE64' is deprecated and shouldn't be used • swagger/lib/auth/http_basic_auth.dart:11:48
info • 'UTF8' is deprecated and shouldn't be used • swagger/lib/auth/http_basic_auth.dart:11:62

Flutter Version

Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git
Framework • revision c7ea3ca377 (4 weeks ago) • 2018-05-29 21:07:33 +0200
Engine • revision 1ed25ca7b7
Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760

Suggest a fix/enhancement

I suggest to add a new option for the dart version and generate code accordingly.

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

Start in samples/client/petstore/dart/flutter_petstore, regenerate with ./bin/dart-petstore.sh, and run flutter analyze to reproduce the listed deprecations. Review the generated files named in the report, including swagger/lib/api_client.dart, swagger/lib/auth/http_basic_auth.dart, and .analysis_options; done means generation avoids Dart 2 deprecation warnings and supports the requested Dart-version option.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.