Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@giautm
Copy link
Collaborator

@giautm giautm commented Apr 2, 2022

No description provided.

Comment on lines 26 to 31
_, err = NewType(&Config{Package: "entc/gen"}, &load.Schema{
Fields: []*load.Field{
{Unique: true, Default: true, Info: &field.TypeInfo{Type: field.TypeInt}},
{Name: "foo", Unique: true, Default: true, Info: &field.TypeInfo{Type: field.TypeInt}},
},
})
require.Error(err, "unique field can not have default")
require.EqualError(err, "unique field \"foo\" cannot have default value")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed the test to EqualError because the test was wrong, it just accept the field name cannot be empty error

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

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

💯

@giautm giautm force-pushed the giautm-fix-id-optional branch from 620c6a8 to b47907e Compare April 2, 2022 17:32
@a8m a8m merged commit 196875c into ent:master Apr 2, 2022
@a8m
Copy link
Member

a8m commented Apr 2, 2022

Thanks @giautm

@giautm giautm deleted the giautm-fix-id-optional branch April 2, 2022 21:31
gitlawr pushed a commit to gitlawr/ent that referenced this pull request Apr 13, 2022
* entc/gen: block Optional on the ID field

* chore: restore the old error message

* Update entc/gen/type.go

Co-authored-by: Ariel Mashraki <[email protected]>

Co-authored-by: Ariel Mashraki <[email protected]>
gitlawr pushed a commit to seal-io/ent that referenced this pull request Apr 13, 2022
* entc/gen: block Optional on the ID field

* chore: restore the old error message

* Update entc/gen/type.go

Co-authored-by: Ariel Mashraki <[email protected]>

Co-authored-by: Ariel Mashraki <[email protected]>
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