Skip to content

Fix #3745: Generate conversion functions per package#3748

Merged
raphael merged 3 commits into
v3from
fix/conversion-files-per-package-issue-3745
Jul 25, 2025
Merged

Fix #3745: Generate conversion functions per package#3748
raphael merged 3 commits into
v3from
fix/conversion-files-per-package-issue-3745

Conversation

@raphael

@raphael raphael commented Jul 25, 2025

Copy link
Copy Markdown
Member

This fix resolves the issue where ConvertTo/CreateFrom functions were generated in the wrong directory when types have Meta("struct:pkg:path") metadata.

Changes:

  • Replace ConvertFile with ConvertFiles to support multi-package generation
  • Group conversions by target package path using UserTypeLocation
  • Add SamePackageConversion flag to AttributeContext for proper type references
  • Add comprehensive test coverage for multi-package conversion scenarios
  • Update service generator to use new ConvertFiles function
  • Add branch naming conventions to CLAUDE.md

The implementation follows the existing multi-package pattern used in service.go and ensures that conversion functions are generated in the correct package directory while maintaining proper type qualification.

…pkg:path metadata

This fix resolves the issue where ConvertTo/CreateFrom functions were generated
in the wrong directory when types have Meta("struct:pkg:path") metadata.

Changes:
- Replace ConvertFile with ConvertFiles to support multi-package generation
- Group conversions by target package path using UserTypeLocation
- Add SamePackageConversion flag to AttributeContext for proper type references
- Add comprehensive test coverage for multi-package conversion scenarios
- Update service generator to use new ConvertFiles function
- Add branch naming conventions to CLAUDE.md

The implementation follows the existing multi-package pattern used in service.go
and ensures that conversion functions are generated in the correct package
directory while maintaining proper type qualification.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
raphael and others added 2 commits July 24, 2025 22:42
- Replace manual string slicing with filepath.Dir() for cross-platform compatibility
- Add filepath.FromSlash() in tests to normalize path separators
- Fixes GitHub Actions Windows test failure in TestConvertFiles

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@raphael raphael merged commit b92c333 into v3 Jul 25, 2025
9 checks passed
@raphael raphael deleted the fix/conversion-files-per-package-issue-3745 branch July 25, 2025 05:58
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.

1 participant