Skip to content

Refacto/using codegen#490

Open
maximeroucher wants to merge 72 commits intomainfrom
refacto/using-codegen
Open

Refacto/using codegen#490
maximeroucher wants to merge 72 commits intomainfrom
refacto/using-codegen

Conversation

@maximeroucher
Copy link
Member

@maximeroucher maximeroucher commented Feb 28, 2025

[MAJOR FLOW]
As some types are nullable in Hyperion and the codegen treat them as dynamic, nested nullable types are cast into JSON when communicating with the API, making the implementation not functional for now !

This is a follow-up of the test : #221

This PR aims to drastically reduce errors while developing and loosing a little time as possible by fully generating classes and repositories codes given the openapi.json file of the corresponding Hyperion, which URL can be changed in the build file.

It adds one command to run the code generation : dart run build_runner build and outputs all the code in the generated folder.

This PR is a breaking for the development part, since futures modules will be required to align with this design.

This PR gets rid of the tokenExpireWrapper and instead uses request interceptors to re-query a token on expiration.

This PR might force a Hyperion PR, fixing some issues with endpoints, never detected until now, because all the parsing was done by hand.

@maximeroucher maximeroucher added enhancement New feature or request core This PR change the core labels Feb 28, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 55.79710% with 366 lines in your changes missing coverage. Please review.

Project coverage is 10.59%. Comparing base (b132463) to head (7d970a3).

Files with missing lines Patch % Lines
lib/auth/repository/auth_repository.dart 0.00% 118 Missing ⚠️
lib/booking/adapters/booking.dart 37.83% 46 Missing ⚠️
lib/auth/providers/openid_provider.dart 0.00% 33 Missing ⚠️
lib/amap/providers/user_order_list_provider.dart 34.09% 29 Missing ⚠️
lib/event/adapters/event.dart 44.89% 27 Missing ⚠️
...amap/providers/delivery_product_list_provider.dart 38.46% 8 Missing ⚠️
lib/admin/providers/group_list_provider.dart 68.18% 7 Missing ⚠️
lib/loan/adapters/item.dart 63.15% 7 Missing ⚠️
lib/amap/providers/cash_list_provider.dart 71.42% 6 Missing ⚠️
lib/amap/providers/delivery_list_provider.dart 85.36% 6 Missing ⚠️
... and 26 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #490       +/-   ##
===========================================
- Coverage   54.15%   10.59%   -43.57%     
===========================================
  Files         169      131       -38     
  Lines        3741    15972    +12231     
===========================================
- Hits         2026     1692      -334     
- Misses       1715    14280    +12565     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maximeroucher maximeroucher force-pushed the refacto/using-codegen branch from 54932b4 to 4adc0c5 Compare March 6, 2025 21:20
@maximeroucher maximeroucher requested a review from Copilot April 30, 2025 19:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the project to use fully generated classes and repository code based on the Hyperion openapi.json file, improving reliability in API communications.

  • Introduces a build.yaml configuration for the swagger_dart_code_generator.
  • Updates analysis_options.yaml to exclude generated files from linting.

Reviewed Changes

Copilot reviewed 617 out of 635 changed files in this pull request and generated no comments.

File Description
build.yaml Adds configuration for code generation with default values.
analysis_options.yaml Excludes generated code from analyzer to reduce false positives.
Files not reviewed (18)
  • lib/admin/adapters/core_membership.dart: Language not supported
  • lib/admin/adapters/groups.dart: Language not supported
  • lib/admin/adapters/module_visibility.dart: Language not supported
  • lib/admin/adapters/school.dart: Language not supported
  • lib/admin/class/account_type.dart: Language not supported
  • lib/admin/class/group.dart: Language not supported
  • lib/admin/class/module_visibility.dart: Language not supported
  • lib/admin/class/school.dart: Language not supported
  • lib/admin/class/simple_group.dart: Language not supported
  • lib/admin/providers/account_types_list_provider.dart: Language not supported
  • lib/admin/providers/all_account_types_list_provider.dart: Language not supported
  • lib/admin/providers/all_groups_list_provider.dart: Language not supported
  • lib/admin/providers/group_list_provider.dart: Language not supported
  • lib/admin/providers/group_provider.dart: Language not supported
  • lib/admin/providers/is_admin_provider.dart: Language not supported
  • lib/admin/providers/is_expanded_list_provider.dart: Language not supported
  • lib/admin/providers/members_provider.dart: Language not supported
  • lib/admin/providers/module_root_list_provider.dart: Language not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core This PR change the core enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants