Skip to content

feat: Make field.UUID Compatible With enthistory.WithInheritIdType#82

Merged
josue merged 4 commits intoflume:mainfrom
frisbm:fix-issue-80
Jan 16, 2026
Merged

feat: Make field.UUID Compatible With enthistory.WithInheritIdType#82
josue merged 4 commits intoflume:mainfrom
frisbm:fix-issue-80

Conversation

@frisbm
Copy link
Contributor

@frisbm frisbm commented Jan 16, 2026

Description

Closes #80

Added support for anonymous function defaults in field.UUID when using WithInheritIdType(). The fix extracts the anonymous function source code from the original schema file using runtime information and includes it in the generated history schema.

Motivation and Context

Fixes the issue where using field.UUID with an anonymous function Default (e.g., Default(func() uuid.UUID { return uuid.Must(uuid.NewV7()) })) caused code generation to fail with:

schemast: only selector exprs are supported for default func

How Has This Been Tested?

  • Added unit tests in generate_test.go covering anonymous function defaults for both direct fields and mixin-based fields
  • Added a new User schema in _examples/graphql that uses the exact reproduction case
  • Verified generated user_history.go properly inherits the anonymous function
  • All existing tests pass

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update or addition to documentation for this project)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@flume-bot
Copy link

flume-bot commented Jan 16, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@frisbm frisbm marked this pull request as ready for review January 16, 2026 20:55
@frisbm frisbm requested a review from caseyh as a code owner January 16, 2026 20:55
@frisbm
Copy link
Contributor Author

frisbm commented Jan 16, 2026

Copy link
Collaborator

@josue josue left a comment

Choose a reason for hiding this comment

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

LGTM

@josue josue merged commit 431b13d into flume:main Jan 16, 2026
5 checks passed
@frisbm frisbm deleted the fix-issue-80 branch January 16, 2026 21:10
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.

field.UUID with Default is incompatible with enthistory.WithInheritIdType

3 participants

Comments