Finish AckType transform support validation#95
Merged
leoafarias merged 6 commits intomainfrom Mar 25, 2026
Merged
Conversation
|
To view this pull requests documentation preview, visit the following URL: Documentation is deployed and generated using docs.page. |
There was a problem hiding this comment.
Pull request overview
Completes @AckType transform support in ack_generator by tracking transformed-schema provenance, updating wrapper generation rules (notably copyWith suppression), tightening cross-file transformed-type resolution, and expanding integration coverage (including a new example).
Changes:
- Add transformed-schema metadata (
ModelInfo.isTransformedSchema,FieldInfo.isTransformedRepresentation) and use it to suppress unsafecopyWith()generation. - Extend schema AST analysis to support built-in transformed helpers (
Ack.uri/date/datetime/duration), explicit.transform<T>(), and stricter cross-file resolution/visibility rules. - Add integration tests + an example transform schema with tracked generated output validated by the example-folder build test.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/ack_generator/test/test_utils/test_assets.dart | Updates test assets to model transformed schemas and new helpers used by integration tests. |
| packages/ack_generator/test/src/test_utilities.dart | Extends MockFieldInfo to include transformed-representation tracking. |
| packages/ack_generator/test/integration/example_folder_build_test.dart | Validates that the example folder generates transform wrappers correctly and avoids unsafe copyWith/reparsing. |
| packages/ack_generator/test/integration/ack_type_transform_test.dart | New end-to-end coverage for top-level and nested transformed schemas + failure cases. |
| packages/ack_generator/test/integration/ack_type_discriminated_test.dart | Ensures discriminated branches suppress copyWith when transformed fields are present. |
| packages/ack_generator/test/integration/ack_type_cross_file_resolution_test.dart | Expands cross-file resolution coverage for transformed refs, prefixes, re-exports, and visibility failures. |
| packages/ack_generator/lib/src/models/model_info.dart | Adds isTransformedSchema to model metadata. |
| packages/ack_generator/lib/src/models/field_info.dart | Adds isTransformedRepresentation to field metadata used by codegen. |
| packages/ack_generator/lib/src/generator.dart | Plumbs transformed-schema metadata through generator model cloning. |
| packages/ack_generator/lib/src/builders/type_builder.dart | Suppresses copyWith when transforms are involved; adjusts getter generation for transformed/special types. |
| packages/ack_generator/lib/src/analyzer/schema_ast_analyzer.dart | Implements transform-aware chain analysis, list element transform analysis, and stricter cross-file transformed type resolution. |
| packages/ack_annotations/lib/src/ack_type.dart | Updates @AckType docs to reflect supported transform behavior and constraints. |
| example/lib/schema_types_transforms.dart | Adds a concrete example demonstrating transform-backed @AckType schemas. |
| example/lib/schema_types_transforms.g.dart | Checks in generated output for the new example transform schema. |
Replace single-type context lookup with per-import namespace scanning to correctly detect when multiple imports expose the same representation type name, and add regression test for the ambiguous import case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This completes AckType transform support for generated wrappers by tracking transformed schema provenance, suppressing unsafe copyWith generation for transform-backed object and discriminated wrappers, and tightening cross-file transformed type resolution. It updates the analyzer, builder, model metadata, and AckType docs to match the supported behavior for direct, prefixed, and re-exported schema refs. The branch also expands generator integration coverage for transformed fields, nested transformed lists, discriminated branches, cross-file visibility failures, and re-exported refs. Finally, it adds a dedicated example transform schema plus tracked generated output, and validates that example build output in the example-folder integration test.