Skip to content

Generator.dio causes error Error: 'NullThrownError' isn't a type. #170

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

Open
isaac-merkos opened this issue Dec 10, 2024 · 1 comment
Open
Labels
bug Something isn't working waiting for response

Comments

@isaac-merkos
Copy link

Description of the bug

When I run dart run build_runner build --delete-conflicting-outputs on a project with this class

// Openapi Generator last run: : 2024-12-10T12:54:07.988426
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';

@Openapi(
    additionalProperties: AdditionalProperties(useEnumExtension: true, pubName: 'api_client'),
    inputSpec: RemoteSpec(path: 'http://localhost:3000/openapi.json'),
    generatorName: Generator.dio,
    skipIfSpecIsUnchanged: false,
    outputDirectory: 'api/api_client')
class Client {}

I get this error

[SEVERE] openapi_generator on lib/client.dart:
Failed to generate content.

Could not complete source generation Failed to generate source code. Build Command output: Failed to build build_runner:build_runner:
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:19:49: Error: 'CyclicInitializationError' isn't a type.
const isCyclicInitializationError = TypeMatcher<CyclicInitializationError>();
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:31:39: Error: 'NullThrownError' isn't a type.
const isNullThrownError = TypeMatcher<NullThrownError>();
                                      ^^^^^^^^^^^^^^^
 #0      OpenapiGenerator.runSourceGen (package:openapi_generator/src/openapi_generator_runner.dart:401:34)
<asynchronous suspension>
#1      OpenapiGenerator.generateSources.<anonymous closure> (package:openapi_generator/src/openapi_generator_runner.dart:346:7)
<asynchronous suspension>
#2      OpenapiGenerator.generateSources (package:openapi_generator/src/openapi_generator_runner.dart:345:12)
<asynchronous suspension>
#3      OpenapiGenerator.generatorV2 (package:openapi_generator/src/openapi_generator_runner.dart:195:7)
<asynchronous suspension>
#4      normalizeGeneratorOutput (package:source_gen/src/output_helpers.dart:10:1)
<asynchronous suspension>
#5      StreamCompleter.setSourceStream (package:async/src/stream_completer.dart:76:3)
<asynchronous suspension>

Steps to reproduce

I am not sure exactly how to reproduce it but every dependency is up to date

Minimal openapi specification

https://petstore3.swagger.io/api/v3/openapi.json

Annotation used

// Openapi Generator last run: : 2024-12-10T12:54:07.988426
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';

@openapi(
additionalProperties: AdditionalProperties(useEnumExtension: true, pubName: 'api_client'),
inputSpec: RemoteSpec(path: 'http://localhost:3000/openapi.json'),
generatorName: Generator.dio,
skipIfSpecIsUnchanged: false,
outputDirectory: 'api/api_client')
class Client {}

Expected behavior

I expected it to generate a client

Logs

No response

Screenshots

No response

Platform

Windows

Library version

6.0.0

Flutter version

3.24.4

Flutter channel

stable

Additional context

This only happens with `Generator.dio` and not with `Generator.dart` unfortunately I need dio
@isaac-merkos isaac-merkos added the bug Something isn't working label Dec 10, 2024
@gibahjoe
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response
Projects
None yet
Development

No branches or pull requests

2 participants