question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[dart-dio-next] [BUG] Import mappings are not working

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
HerrNiklasRaabcommented, Oct 15, 2021

@kuhnroyal Sent the money, thanks for your help!

0reactions
kuhnroyalcommented, Oct 13, 2021

@HerrNiklasRaab Check the PR commit for the committer email.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found