[dart-dio-next] [BUG] Import mappings are not working
Created by: HerrNiklasRaab
Before reading the issue, the following two things are important:
- I am supporting fixing this issue with 50€
- I know that there is the option "dateLibrary: timemachine", but I need to solve it using "import-mappings" because of another reason I don't want to go into here (which should be possible, because I was already able to set up below use case in the backend).
I am running openapi-generator with the following command:
openapi-generator generate -g dart-dio-next \
-i ./api/_config/specs/backend-functional.yml \
-o ./api/backend-api \
-c ./api/_config/specs/backend-functional-config.yml
with the this configuration:
additionalProperties:
pubName: backend_api
typeMappings:
object: dynamic
JsonObject: dynamic
LocalDate: LocalDate
importMappings:
LocalDate: "package:time_machine/time_machine.dart"
with this yaml:
CronRunConfiguration:
properties:
fakeDate:
$ref: "#/components/schemas/LocalDate"
LocalDate:
type: object
which generates the following code:
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_collection/built_collection.dart';
import 'package:backend_api/src/model/local_date.dart'; // Wrong import, expected: "package:time_machine/time_machine.dart"
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'cron_run_configuration.g.dart';
/// CronRunConfiguration
///
/// Properties:
/// * [fakeDate]
/// * [runCronFor]
abstract class CronRunConfiguration implements Built<CronRunConfiguration, CronRunConfigurationBuilder> {
@BuiltValueField(wireName: r'fakeDate')
LocalDate? get fakeDate;
// ... The rest of the file is not important
what I would have expected is the following:
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_collection/built_collection.dart';
import 'package:time_machine/time_machine.dart'; // This is the important line
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'cron_run_configuration.g.dart';
/// CronRunConfiguration
///
/// Properties:
/// * [fakeDate]
/// * [runCronFor]
abstract class CronRunConfiguration implements Built<CronRunConfiguration, CronRunConfigurationBuilder> {
@BuiltValueField(wireName: r'fakeDate')
LocalDate? get fakeDate;
// ... The rest of the file is not important
cc @kuhnroyal @wing328 Can you reproduce?