openapi-generator-dart
openapi-generator-dart copied to clipboard
Library seems broken on newest dart version
Hey guys,
I wanted to try out your package as the CLI version of openapi gen does not support null-safety. I have created a new class, added annotations, added all the dependencies-
When I run the build_runner it gives me the following error, which is not very helpful imo. Any ideas ? seems to be related to library I guess.
Thank you in advance guys - cheers! 🚀
Dart Version
Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "macos_x64"
Class
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
@Openapi(
additionalProperties:
AdditionalProperties(pubName: 'get_order_api', pubAuthor: 'Johnny dep'),
inputSpecFile: 'lib/purchase_order_new_oas.yaml',
generatorName: Generator.DART,
outputDirectory: 'api/purchase_order_new_oas.yaml')
class Example extends OpenapiGeneratorConfig {}
Pubspec
dependencies:
flutter:
sdk: flutter
openapi_generator_annotations: ^1.1.4
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
openapi_generator: ^1.1.4
build_runner: ^1.11.5
Terminal Output
Failed to build build_runner:build_runner:
../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
- 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart').
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
var kindNames = kinds.map((kind) => kind.displayString).toList()
^^^^^^^^^^^^^
../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:1950:14: Context: This is one of the extension members.
String get displayString {
^^^^^^^^^^^^^
../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
String get displayString {
^^^^^^^^^^^^^
../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:260:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
- 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
var validKinds = kindNames.commaSeparatedWithOr;
^^^^^^^^^^^^^^^^^^^^
pub finished with exit code 1
The import gives the following warning
openapi_generator_annotations package:openapi_generator_annotations/openapi_generator_annotations.dart
Support for doing something awesome.
More dartdocs go here.
The library 'package:openapi_generator_annotations/openapi_generator_annotations.dart' is legacy, and should not be imported into a null safe library. Try migrating the imported library.dart(import_of_legacy_library_into_null_safe)