Skip to content

Finish AckType transform support validation#95

Merged
leoafarias merged 6 commits intomainfrom
feat/acktype-transform-support
Mar 25, 2026
Merged

Finish AckType transform support validation#95
leoafarias merged 6 commits intomainfrom
feat/acktype-transform-support

Conversation

@leoafarias
Copy link
Collaborator

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.

Copilot AI review requested due to automatic review settings March 25, 2026 02:09
@docs-page
Copy link

docs-page bot commented Mar 25, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/btwld/ack~95

Documentation is deployed and generated using docs.page.

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

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 unsafe copyWith() 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.
@leoafarias leoafarias merged commit 059499d into main Mar 25, 2026
1 check passed
@leoafarias leoafarias deleted the feat/acktype-transform-support branch March 25, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants