Open lukepighetti opened 2 years ago
Just manually updated all deps to the following:
name: openapi
version: 1.0.0
description: OpenAPI API client
homepage: homepage
environment:
sdk: '>=2.7.0 <3.0.0'
dependencies:
dio: ^4.0.6
built_value: ^8.2.3
built_collection: ^5.1.1
dev_dependencies:
built_value_generator: ^8.2.3
build_runner: ^2.1.10
test: ^1.21.1
This allowed build_runner to complete, but there are numerous syntax issues. It looks like the implementing classes are not overriding methods with appropriate arguments or return types resulting in static analysis errors.
Can confirm that I was previously using dart_dio_next
without issues, but now trying to switch to the new dart-dio
the generator is stuck on building.
I tried @lukepighetti 's suggestion of updating deps, but I get the following :
Running "flutter pub get" in brand-service-sdk... 5.0s
Failed to build build_runner:build_runner:
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:args
- package:build_runner_core
- package:io
- package:logging
- package:build_runner
- package:build
- package:glob
- package:crypto
- package:watcher
- package:build_config
- package:build_resolvers
- package:timing
- package:graphs
- package:package_config
- package:yaml
- package:code_builder
- package:dart_style
- package:build_daemon
- package:http_multi_server
- package:shelf
- package:pub_semver
- package:pubspec_parse
- package:analyzer
- package:convert
- package:built_value
- package:built_collection
- package:http_parser
- package:shelf_web_socket
- package:web_socket_channel
- package:_fe_analyzer_shared
- package:checked_yaml
- package:matcher
- package:quiver
- package:fixnum
- package:cli_util
For solutions, see https://dart.dev/go/unsound-null-safety
../../../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.11.1+1/bin/build_runner.dart:89:9: Warning: Operand of null-aware operation '?.' has type 'StreamSubscription<dynamic>' which excludes null.
- 'StreamSubscription' is from 'dart:async'.
await logListener?.cancel();
^
pub finished with exit code 1
I have changed my pubspec.yaml into the following, because of incompatibilities with sdk 2.12.0
name: xxxx
version: 1.0.0
description: OpenAPI API client
homepage: homepage
environment:
sdk: '>=2.7.0 <3.0.0'
dependencies:
dio: '^4.0.0'
built_value: '>=8.0.0 <9.0.0'
built_collection: '>=5.0.0 <6.0.0'
dev_dependencies:
built_value_generator: '>=8.0.0 <9.0.0'
build_runner: any
test: '>=1.21.1 <2.0.0'
analyzer: 4.1.0
dependency_overrides:
meta: 1.8.0
It finally generates the code, but Dio 4.x.x simply doesn't work with this library:
final _response = await _dio.request<dynamic>(
_request.path,
data: _bodyData,
options: _request,
);
This library seems out-of-date and cannot work with the latest version of Dio and dart sdk anymore
I have the exact same issue. When I use dart-dio-next in my command for generating the openapi the build works but I get a parse error as soon as I use my API calls. I've already created an issue on this with more details. Does anybody know different openapi generators for dart (with null safety)?
I think nullsafety are solved by now. Please re-check and close the issue if so.
dio
is deprecated, this generation target should also be deprecated or migrated to diox
@lukepighetti You are working with outdated information. diox
is archived and dio: 5.0.0
was released. See #14675
dart-dio
fails to generate the Twitter v2 API spec. The outputted code has syntax errors that does not allowbuild_runner
to generate the final pieces of codehttps://api.twitter.com/2/openapi.json
openapi.json.zip
Related to: