[dart-dio-next] [BUG] Import mappings are not working
See original GitHub issueBefore 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?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Import Mapping Process Throws Error On Time Format Value
Why are we seeing an Invalid Time Format attribute value error while importing the exported mapping? Solution. Sign In. To view full details, ......
Read more >Field Mapping for Other Data Sources and Organization Import
Note The default mappings listed below are offered as a guide for importing; they do not ensure 100% accuracy in mapping your data....
Read more >Map an import - Anaplan Technical Documentation
When you import data, you must map the columns and items in the source to columns ... Any items that do not map...
Read more >Copy Data Import Schemas not working for API call in ADF
It is working because I can route the output to json or a table I've manually mapped, and we receive data. It is...
Read more >Swagger Codegen use existing class - Stack Overflow
In this case, you can simply specify an import mapping to tell the codegen what not to create. When doing this, every location...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kuhnroyal Sent the money, thanks for your help!
@HerrNiklasRaab Check the PR commit for the committer email.