Skip to content
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

[dart][dart-dio] Add built_value date support w/o timemachine #9180

Merged
merged 4 commits into from
Apr 13, 2021

Conversation

kuhnroyal
Copy link
Contributor

@kuhnroyal kuhnroyal commented Apr 5, 2021

Fixes #9095

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 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@auto-labeler
Copy link

auto-labeler bot commented Apr 5, 2021

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@kuhnroyal
Copy link
Contributor Author

CC @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12)

@kuhnroyal kuhnroyal marked this pull request as ready for review April 6, 2021 18:54
@jannikrh
Copy link

jannikrh commented Apr 7, 2021

While testing the generator and thereby this PR, I noticed two problems. The first one is directly related to the extension. The second one might be a separate issue for which I can open a new issue.

  1. In the file serializers.dart the import for the new Date class is missing.
import 'package:trainer_api/src/model/date.dart';

Which leads to the following errors.

error - Undefined name 'Date' - lib\src\serializers.g.dart:34:59 - undefined_identifier
error - The name 'Date' isn't a type so it can't be used as a type argument - lib\src\serializers.g.dart:35:33 - non_type_as_type_argument
  1. When using a pure type: object the import package:built_value/json_object.dart; for the JsonObject is missing.

@kuhnroyal
Copy link
Contributor Author

Do you have an example spec or repro?
The date import should not be needed since the date serializer is added, not sure.

Please create a new issue for 2. and CC me.

@jannikrh
Copy link

jannikrh commented Apr 7, 2021

The problem occurs in this basic example. With flutter analyze, the missing import is noticeable. In this case, import 'model/date.dart'; needs to added to serializers.dart.

error - Undefined name 'Date' - lib\src\serializers.g.dart:12:59 - undefined_identifier
error - The name 'Date' isn't a type so it can't be used as a type argument - lib\src\serializers.g.dart:13:33 - non_type_as_type_argument
openapi: 3.0.1
info:
  version: 1.0.0
  title: Trainer
paths:
  /test:
    get:
      responses:
        '200':
          description: Groups
          content:
            application/json:
                schema:
                  type: array
                  items:
                    type: object
                    required:
                      - uuid
                      - name
                      - dates
                    properties:
                      uuid:
                        type: string
                        format: uuid
                      name:
                        type: string
                        example: Group A
                      trainingDates:
                        type: array
                        description: Training dates
                        items:
                          type: string
                          format: date
                          

@kuhnroyal
Copy link
Contributor Author

I see, an array of dates.

@kuhnroyal
Copy link
Contributor Author

  1. should be fixed

@kuhnroyal
Copy link
Contributor Author

Shippable failure is unrelated.

@jannikrh
Copy link

jannikrh commented Apr 7, 2021

  1. should be fixed

Now works as intended.

@kuhnroyal
Copy link
Contributor Author

Looking for reviews

@wing328 wing328 added this to the 5.1.1 milestone Apr 13, 2021
@wing328
Copy link
Member

wing328 commented Apr 13, 2021

All tests passed after restart.

@wing328 wing328 merged commit b4ea00e into OpenAPITools:master Apr 13, 2021
@kuhnroyal kuhnroyal deleted the dart-dio/date-support branch April 13, 2021 09:04
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.

[dart-dio][dart-dio-next] Support Date Type
3 participants