Skip to content

[dart-dio][timemachine] Bugfix: saving offset_date_serializer instead of local_date_serialize #20907

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
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

epou
Copy link
Contributor

@epou epou commented Mar 17, 2025

Using dart-dio with timemachine leads to 'uri_does_not_exist' in lib/src/serializers.dart

Target of URI doesn't exist: 'package:packageName/src/offset_date_serializer.dart'.
Try creating the file referenced by the URI, or try using a URI for a file that does exist. dart(uri_does_not_exist)

It looks like the bug was introduced here (#9180), where

  • local_date_serializer.mustache is renamed to offset_date_serializer.mustache (see)
  • Start using import import 'package:{{pubName}}/src/offset_date_serializer.dart'; in serializers.mustache (see)
  • Java code is using the new offset_date_serializer.mustache but still creating the local_date_serializers.dart (see)

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)

@kuhnroyal
Copy link
Contributor

Seems nobody is using time_machine anymore if this didn't come up until now. Whats your use-case for the library?

@epou
Copy link
Contributor Author

epou commented Mar 17, 2025

We were just testing both options for dateLibrary (core and timemachine) to decide what to use on our case and came up with this bug.
Let us know if timemachine is deprecated or if it's recommended to use 'core'...

@kuhnroyal
Copy link
Contributor

The package has not received updates in 2 years, so I would personally recommend against it. Thats why I added the core implementation in the first place.

@kuhnroyal
Copy link
Contributor

@wing328

@epou epou changed the title [dart-dio] Bugfix: saving offset_date_serializer instead of local_date_serialize [dart-dio][timemachine] Bugfix: saving offset_date_serializer instead of local_date_serialize Mar 18, 2025
@wing328 wing328 added this to the 7.13.0 milestone Mar 23, 2025
@wing328
Copy link
Member

wing328 commented Mar 23, 2025

thanks for the PR

would it be possible to add a config to cover this change by creating a config file similar to one of the followings?

./bin/configs/dart-dio-oneof-polymorphism-and-inheritance.yaml
./bin/configs/dart-dio-petstore-client-lib-fake.yaml
./bin/configs/dart-dio-oneof-primitive.yaml
./bin/configs/dart-petstore-client-lib-fake.yaml
./bin/configs/dart-dio-oneof.yaml
./bin/configs/dart-petstore-client-lib.yaml
./bin/configs/dart-dio-petstore-client-lib-fake-json_serializable.yaml

and then generate and commit the new files, finally put the new folder in the github workflow: https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-dart.yaml

@kuhnroyal
Copy link
Contributor

We could add one but probably not all combinations.

@wing328
Copy link
Member

wing328 commented Mar 24, 2025

We could add one but probably not all combinations.

agreed.

@epou
Copy link
Contributor Author

epou commented Mar 24, 2025

I've just added a new config as suggested

@kuhnroyal
Copy link
Contributor

@epou I think you need to generate samples again. That should update the FILES file.
But something is still wrong with the serializers.dart file.

@epou epou force-pushed the dart_dio_timemachine_import_error branch from bf79eac to 3c03bfe Compare March 25, 2025 08:11
@epou
Copy link
Contributor Author

epou commented Mar 25, 2025

I've just rebased from master to include the latest changes that were recently merged (#20908)

@wing328
Copy link
Member

wing328 commented Mar 26, 2025

i tried to break the build: b223263

but the dart tests still passed: https://github.com/OpenAPITools/openapi-generator/actions/runs/14076327860/job/39419864460?pr=20972

not sure if we need to update "samples.dart" somehow:

@wing328
Copy link
Member

wing328 commented Mar 26, 2025

what about later migrating the dart github workflow to a list of "samples" folders instead, e.g. https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-kotlin-client.yaml#L20 ?

(not required as part of this PR)

@wing328 wing328 modified the milestones: 7.13.0, 7.14.0 Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants