Skip to content

Commit

Permalink
entc/gen: revert unwrapping logic for validation error
Browse files Browse the repository at this point in the history
Fixed #698
  • Loading branch information
a8m committed Sep 1, 2020
1 parent 86b36e7 commit 0c3ba9b
Show file tree
Hide file tree
Showing 27 changed files with 40 additions and 30 deletions.
4 changes: 2 additions & 2 deletions entc/gen/internal/bindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil
}

var _templateBaseTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x58\xdd\x6f\xdb\x38\x12\x7f\xb6\xfe\x8a\x81\xe0\xdb\xb3\xb3\x8e\xd4\xcd\xdb\x15\xc8\x43\x36\x68\xee\x0a\xec\xa6\x7b\xc8\xde\xf6\xf1\xc0\x48\x23\x99\x08\x4d\x2a\x24\xe5\xc4\x10\xfc\xbf\x2f\x86\x1f\xfa\x70\xdc\x24\x4d\x5a\xa0\x81\x3d\x43\xce\xd7\xef\x37\x43\xd2\x5d\x97\x9f\x24\x97\xaa\xd9\x69\x5e\xaf\x2d\x9c\x7d\xf8\xe5\x5f\xa7\x8d\x46\x83\xd2\xc2\x15\x2b\xf0\x56\xa9\x3b\xf8\x2c\x8b\x0c\x2e\x84\x00\xb7\xc8\x00\xe9\xf5\x16\xcb\x2c\xf9\x73\xcd\x0d\x18\xd5\xea\x02\xa1\x50\x25\x02\x37\x20\x78\x81\xd2\x60\x09\xad\x2c\x51\x83\x5d\x23\x5c\x34\xac\x58\x23\x9c\x65\x1f\xa2\x16\x2a\xd5\xca\x32\xe1\xd2\xe9\x7f\xfb\x7c\xf9\xe9\xfa\xe6\x13\x54\x5c\x20\x04\x99\x56\xca\x42\xc9\x35\x16\x56\xe9\x1d\xa8\x0a\xec\xc8\x99\xd5\x88\x59\x72\x92\xef\xf7\x49\xd2\x75\x50\x62\xc5\x25\x42\x7a\xcb\x0c\xa6\x10\x84\xf3\xe6\xae\x86\x8f\xe7\x40\x42\x98\x67\x97\x4a\x56\xbc\xce\xfe\x60\xc5\x1d\xab\x91\x16\x75\x1d\x58\xdc\x34\x82\x59\x84\x74\x8d\xac\x44\x9d\xc2\x3c\x6e\x1f\x54\x7c\xd3\x28\x6d\xa3\x2a\xcf\x81\xaa\xc3\x04\x67\x06\x0d\x58\x05\x6c\xab\x78\x09\x7e\x15\x14\x4a\x56\x82\x17\x96\xf2\x68\x0d\xea\x7f\x1a\x57\x99\x2c\xb1\xbb\x06\x61\x91\xcc\xbe\x34\x10\xff\x9d\x93\xa5\xec\x4b\x93\xcc\xfe\x43\x75\x1e\x0b\x49\x90\xcc\xfe\x62\xa2\xc5\xb1\xd8\x09\x92\xd9\x7f\x5b\xd4\xbb\xb1\xdc\x09\x92\xd9\x1f\x4a\xf0\x62\x37\x92\x7b\x41\x32\xfb\xbd\xb5\xcc\x2a\x3d\x28\x82\x20\x68\xb8\x92\x53\x0d\x57\x32\xa8\xf0\xaa\x95\xc5\x58\xe5\x04\xc9\xd2\x15\xe2\x8b\x2e\x51\xbb\x05\xac\x69\x04\x47\x03\x4c\x82\x22\x21\x97\x35\x28\x09\xc8\xed\x1a\x35\xd4\x9a\x35\x6b\xb0\x9a\x6d\x51\x1b\x26\x40\x69\x30\xf7\x02\x0c\x0a\x07\x6f\x28\xce\x60\xad\x6a\x65\xb1\x20\x08\xb3\x1b\xab\x34\xab\x31\xfb\xb5\xe5\x82\xe8\xb4\xdf\x2f\x1d\x3a\x9a\xc9\x1a\x61\x5e\xad\x60\xee\xfc\x11\xd0\xfe\xc3\x7e\x9f\xcc\x68\x6b\x05\xe7\xd0\x30\x53\x30\x41\x9f\x49\x9a\xe7\xe0\x15\xfb\x7d\x1f\x2f\x51\xad\xe6\x5b\x94\x50\x71\x14\xa5\x21\xd8\xba\x0e\xda\xa6\x41\x1d\x96\x3a\xb3\x59\x32\xa3\xa0\x7a\x03\x8b\xb0\x3c\xcb\x32\x63\x29\xdb\xe5\x28\xfc\x2e\x99\xcd\xba\xee\x14\x1e\xb8\x5d\x03\x3e\x5a\x94\x25\x2c\xb8\x2c\xf1\x11\xe6\xd9\xb5\x2a\xd1\xc0\x87\x25\xa4\xb4\x36\x25\x73\xa9\xdb\x9a\xc6\x54\x4e\x29\xd8\x99\x4b\xc2\x6e\x1a\x41\xa9\x35\x9a\x4b\x5b\x41\x5a\x72\x46\x25\xcb\xff\x61\x72\x15\xf6\xc4\x12\x81\xdf\xa5\xd1\xb6\xda\xe5\xf0\xd8\x33\xd8\x9b\xc9\xfc\x8a\xae\x03\x8a\xc7\x39\x71\x3d\x40\xdf\x62\xcb\x3c\xe3\xaf\xd6\xaa\x6d\x72\xc3\x6b\xc9\x6c\xab\xf1\xc0\x73\x9e\xc3\x45\x5d\x6b\xac\x23\x63\x46\x84\x60\x41\x41\x2c\x33\x16\x1b\x22\x86\xab\x3b\x59\x3c\xbd\xdd\x0d\xc4\xc8\x07\x46\x7c\x2b\x01\xc7\xbb\x0b\x43\x93\x86\x41\x63\xb0\x2d\xd5\xc4\x01\xa1\xe4\x3f\x28\x0d\x1a\x25\xdb\x10\x15\x99\x54\x8e\x88\xfe\x6f\x5c\x63\x3c\x42\x45\x6b\xac\xda\x80\x64\x1b\x34\x19\x5c\x29\x0d\xf8\xc8\x36\x8d\xc0\x8f\x49\x9e\x27\x79\x3e\xfb\x37\x05\xfa\xeb\xce\x63\xfe\xcb\xca\x53\xe5\x6c\x99\x91\xae\xcf\x7a\x11\x47\xce\x7e\x9f\x5d\x98\xf1\xb7\x9b\x76\x13\xb6\x2e\x57\x90\x9a\x76\xf3\x7f\xff\x2d\x5d\xae\xe0\x15\xbb\xce\x26\xbb\xce\xd2\xa5\x77\x7c\x53\x30\xb9\x28\xec\xe3\x0a\x7e\xda\x2e\x29\x50\xc7\xcf\x0b\xb3\xa8\xe4\x14\x8a\x95\x43\x38\xb2\x74\x8a\x52\x97\x38\xa2\xfa\xfa\x3e\x03\x3b\x33\x87\x4c\x7b\x81\x67\xfb\x71\x97\x52\x65\x57\x30\xa7\x62\x5f\x51\x0e\xc4\xb0\x88\x19\x0e\x0d\x2b\x1d\xf3\x42\xcb\xd2\x9e\x5e\xf5\x22\x2d\x0b\x25\x8d\x3d\x0c\xb1\xeb\x80\x57\xb0\x66\xe6\xcf\x69\x80\xb1\x0d\x5e\x68\xcf\x6b\xb6\x21\x96\xbb\x40\xfa\x5e\x95\xa3\xee\x7c\xbe\xc1\x42\x04\xb1\xbb\xfa\xe9\x23\x0f\xc7\x4f\xd7\xc1\x7d\xab\x2c\xf6\x39\x1f\xe7\xb3\x72\xc5\xe6\xd5\xb8\x8e\xfb\xfd\xc1\xfc\xa2\x73\xb2\x77\x8a\xac\x58\xfb\x26\x9b\x4c\x2f\x0a\x60\x71\xc4\x94\x37\xe0\x79\xd2\xdb\x38\x42\x98\xef\x19\x6d\x12\xd2\xaf\xd1\x45\x3a\x76\xf7\xba\x19\xe7\xc1\xad\xbc\xb1\x1f\x36\xe8\xf2\x1c\xfe\x62\x82\x97\xae\xc0\x9f\xb4\x76\x83\x82\x8c\x19\x78\x58\xa3\x84\x6d\x50\xd2\xdc\x08\x65\xad\x18\x17\x26\x1c\x53\x87\x7b\x8d\xd5\x6d\x61\xa1\x4b\xe8\x74\x25\xd2\x84\x1a\x42\x9e\x83\x4f\x96\x26\x4a\x59\xa3\x9b\x30\x99\x5b\x86\x5a\xd3\x7f\xa5\x13\x1f\x8f\xb7\xc4\x69\xe8\x6c\x50\x5a\x4f\x0c\xf4\x42\x69\x51\x57\xac\xc0\xcc\x77\xf8\x02\xe1\xe4\x20\x84\xa5\xdf\xbf\x58\x46\xcf\x3e\x96\x50\x21\xcc\x50\xeb\x2c\xac\x08\xfe\xfe\x27\x1f\x34\x6b\x8e\x3a\x34\xd9\x57\xcd\xdc\xf1\xf7\x2a\xcf\xde\xd2\x62\x19\xa2\x9d\x7a\xf6\xf6\xc2\x12\x17\x47\x0c\xe0\xb3\xf9\x16\x04\x0c\x6e\x95\x12\xc8\x24\x70\x59\xf2\xc2\xe3\xf0\xb0\x46\x37\xb9\x47\x65\xa1\x95\x01\x29\x15\x5c\x85\x38\x9f\xd8\x5e\xf4\xe5\x5e\x3a\xe3\xc4\x62\x5e\x39\x10\xce\xcf\x41\x72\x27\x88\x84\xaa\x98\x30\x48\x8c\x99\x6d\x99\x86\xa7\x29\xf7\xa3\x2f\x64\x77\x61\xc8\xfc\x0a\x7e\xc2\x98\xdb\xb5\xb2\x57\x74\xbd\x3d\x42\x2d\xab\x77\x94\x8e\x55\x50\xa1\x2d\xd6\xc0\xc0\x34\x58\xf0\x8a\x17\x74\xc1\xe2\x76\x07\x4c\x96\xc0\x2d\x3c\x30\x03\x52\x59\x7f\x4f\x8e\x77\xe2\x92\x59\x46\xb7\xd9\x40\xc4\xa9\x9f\x9e\x86\x33\xc1\x6e\x51\x04\x2a\xbc\x8d\x5f\x13\xcb\x47\xd8\x15\x4b\x90\x0e\xe7\xd5\x47\x48\xe1\x67\xc0\xcc\x3b\xff\x19\xd2\x21\xfc\xb4\xc7\x3c\xda\x7d\x13\xd8\x43\x39\xa6\x60\x47\xa3\xef\x43\x79\x92\xf2\xcb\x18\xff\xce\xcc\x5d\x9f\xcd\x86\x99\x3b\x82\x4b\x1f\x89\x6f\xbc\x70\x1c\x61\x6c\x17\x0a\x71\x9a\xc3\x72\x1c\xa7\xe4\xc2\x45\x39\xc4\x33\x90\xec\x86\xcb\xba\x15\x4c\xbf\x8e\x67\x61\xf1\x98\x67\x1b\xa5\x91\xaa\x4c\x87\x0b\x3a\xca\xbd\x40\xb7\xa9\xc7\x1f\xcc\xb8\x89\xf1\xf7\x90\x2e\xa6\x3a\xe1\x5d\xb4\xfe\x66\xea\x0d\x05\x3c\x64\x5f\x34\xfd\x6e\x02\x4e\x2a\xf0\xaa\x39\xf3\x9b\x62\x25\x3e\x3f\x68\x6a\xb4\x2e\x83\x92\xa0\x66\xc3\x64\x11\x6e\x2b\xd0\xf5\x7b\x8d\x70\x4f\x0f\xc8\x01\xe8\xb1\xdd\x01\x66\x77\x88\xbd\x13\xe5\x91\xe5\xef\xc3\xd8\x39\x27\x88\xdd\x87\x69\x16\x13\xa4\xbd\x87\x37\xe3\x1c\xea\xf2\x04\x65\x6f\xf6\xdd\x18\x8f\xf2\x7f\x19\xe1\x4b\xba\xd6\x6a\xc6\xa5\x7d\x16\xe2\x42\x23\xb3\x98\xb7\x4d\x49\x97\x20\xea\x65\xa5\x7d\x73\xbb\x66\xf7\xcf\xb0\x92\x0c\x8e\x75\xee\x27\x15\xe4\x1a\x8a\xde\x8b\x71\x17\x1d\x2c\x27\xaf\xa0\x15\x6c\xb9\x12\xfe\x36\xaa\x2a\x5f\x7e\xa5\xc9\x9a\xbf\x1b\xb5\x92\xdf\xb7\x28\xd1\xc4\x0b\xd2\x61\xd4\x03\x81\x36\xa6\x8e\xfc\x99\xb9\x0b\xc8\xdb\xef\x40\x07\x4e\x5e\xcb\xa5\x21\xd7\x90\x6a\xa4\xd7\xc6\xd4\xef\xbd\x1b\x3d\x09\xe9\xc9\xdd\xa8\x07\x3c\x23\x45\x4f\xda\x6f\xc1\xfc\x3d\xd4\x3d\x48\xac\xd5\xd8\x93\xf7\xc0\xfc\xfb\x28\x7c\x60\xec\x05\x0e\x77\x5d\x7e\x02\xf8\xd8\xb0\x78\x2a\x02\x31\xc4\xd1\x11\x6a\xa1\x6e\x99\x80\x35\x8a\x06\xb5\xc9\xc0\xfd\x9a\xd7\x3f\x08\x8e\xbe\x07\xbc\x93\x83\xb7\xc0\x73\xcf\xbc\x23\xaf\x83\x79\xd8\xf3\xe4\x67\x8f\xe3\x2f\x10\x17\xe4\x8f\x77\x19\x3e\xfe\x1d\x00\x00\xff\xff\xc1\x8b\x76\x8b\x80\x15\x00\x00")
var _templateBaseTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x58\x4d\x6f\xdb\x3c\x12\x3e\x5b\xbf\x62\x20\x78\xdf\xb5\x53\x47\x6a\x73\xdb\x02\x39\xa4\x41\xb3\x5b\xa0\x4d\xbb\x48\xb7\x3d\x2e\x18\x69\x24\x13\xa1\x48\x85\xa4\x9c\x18\x82\xff\xfb\x8b\x21\xa9\x2f\xc7\x4d\xd2\xa4\x05\x1a\xd8\x33\xe4\x7c\x3d\xcf\x8c\x46\x6e\xdb\xf4\x28\x3a\x57\xf5\x56\xf3\x72\x6d\xe1\xe4\xed\xbb\x7f\x1d\xd7\x1a\x0d\x4a\x0b\x17\x2c\xc3\x6b\xa5\x6e\xe0\x93\xcc\x12\x38\x13\x02\xdc\x21\x03\xa4\xd7\x1b\xcc\x93\xe8\xfb\x9a\x1b\x30\xaa\xd1\x19\x42\xa6\x72\x04\x6e\x40\xf0\x0c\xa5\xc1\x1c\x1a\x99\xa3\x06\xbb\x46\x38\xab\x59\xb6\x46\x38\x49\xde\x76\x5a\x28\x54\x23\xf3\x88\x4b\xa7\xff\xfc\xe9\xfc\xe3\xe5\xd5\x47\x28\xb8\x40\x08\x32\xad\x94\x85\x9c\x6b\xcc\xac\xd2\x5b\x50\x05\xd8\x91\x33\xab\x11\x93\xe8\x28\xdd\xed\xa2\xa8\x6d\x21\xc7\x82\x4b\x84\xf8\x9a\x19\x8c\x21\x08\xe7\xf5\x4d\x09\xef\x4f\x81\x84\x30\x4f\xce\x95\x2c\x78\x99\x7c\x63\xd9\x0d\x2b\x91\x0e\xb5\x2d\x58\xac\x6a\xc1\x2c\x42\xbc\x46\x96\xa3\x8e\x61\xde\x5d\x1f\x54\xbc\xaa\x95\xb6\x9d\x2a\x4d\x81\xaa\xc3\x04\x67\x06\x0d\x58\x05\x6c\xa3\x78\x0e\xfe\x14\x64\x4a\x16\x82\x67\x96\xf2\x68\x0c\xea\x7f\x1a\x57\x99\x24\xb2\xdb\x1a\x61\x11\xcd\xbe\xd6\xd0\xfd\x3b\x25\x4b\xc9\xd7\x3a\x9a\xfd\x87\xea\x3c\x16\x92\x20\x9a\xfd\x60\xa2\xc1\xb1\xd8\x09\xa2\xd9\x7f\x1b\xd4\xdb\xb1\xdc\x09\xa2\xd9\x37\x25\x78\xb6\x1d\xc9\xbd\x20\x9a\x7d\x69\x2c\xb3\x4a\x0f\x8a\x20\x08\x1a\xae\xe4\x54\xc3\x95\x0c\x2a\xbc\x68\x64\x36\x56\x39\x41\xb4\x74\x85\xf8\xaa\x73\xd4\xee\x00\xab\x6b\xc1\xd1\x00\x93\xa0\x48\xc8\x65\x09\x4a\x02\x72\xbb\x46\x0d\xa5\x66\xf5\x1a\xac\x66\x1b\xd4\x86\x09\x50\x1a\xcc\xad\x00\x83\xc2\xc1\x1b\x8a\x33\x58\x2b\x1a\x99\x2d\x08\xc2\xe4\xca\x2a\xcd\x4a\x4c\x3e\x34\x5c\x10\x9d\x76\xbb\xa5\x43\x47\x33\x59\x22\xcc\x8b\x15\xcc\x9d\x3f\x02\xda\x7f\xd8\xed\xa2\x19\x5d\x2d\xe0\x14\x6a\x66\x32\x26\xe8\x33\x49\xd3\x14\xbc\x62\xb7\xeb\xe3\x25\xaa\x95\x7c\x83\x12\x0a\x8e\x22\x37\x04\x5b\xdb\x42\x53\xd7\xa8\xc3\x51\x67\x36\x89\x66\x14\x54\x6f\x60\x11\x8e\x27\x49\x62\x2c\x65\xbb\x1c\x85\xdf\x46\xb3\x59\xdb\x1e\xc3\x1d\xb7\x6b\xc0\x7b\x8b\x32\x87\x05\x97\x39\xde\xc3\x3c\xb9\x54\x39\x1a\x78\xbb\x84\x98\xce\xc6\x64\x2e\x76\x57\xe3\x2e\x95\x63\x0a\x76\xe6\x92\xb0\x55\x2d\x28\xb5\x5a\x73\x69\x0b\x88\x73\xce\xa8\x64\xe9\x3f\x4c\xaa\xc2\x9d\xae\x44\xe0\x6f\x69\xb4\x8d\x76\x39\xdc\xf7\x0c\xf6\x66\x12\x7f\xa2\x6d\x81\xe2\x71\x4e\x5c\x0f\xd0\xb7\xae\x65\x1e\xf1\x57\x6a\xd5\xd4\xa9\xe1\xa5\x64\xb6\xd1\xb8\xe7\x39\x4d\xe1\xac\x2c\x35\x96\x1d\x63\x46\x84\x60\x41\x41\x2c\x33\x16\x6b\x22\x86\xab\x3b\x59\x3c\xbe\xde\x0e\xc4\x48\x07\x46\xfc\x2a\x01\xc7\xbb\x33\x43\x93\x86\x41\x6d\xb0\xc9\xd5\xc4\x01\xa1\xe4\x3f\x28\x0d\x1a\x25\xab\x88\x8a\x4c\x2a\x47\x44\xff\xb7\x3b\x63\x3c\x42\x59\x63\xac\xaa\x40\xb2\x0a\x4d\x02\x17\x4a\x03\xde\xb3\xaa\x16\xf8\x3e\x4a\xd3\x28\x4d\x67\xff\xa6\x40\x3f\x6c\x3d\xe6\xef\x56\x9e\x2a\x27\xcb\x84\x74\x7d\xd6\x8b\x6e\xe4\xec\x76\xc9\x99\x19\x7f\xbb\x6a\xaa\x70\x75\xb9\x82\xd8\x34\xd5\xff\xfd\xb7\x78\xb9\x82\x67\xdc\x3a\x99\xdc\x3a\x89\x97\xde\xf1\x55\xc6\xe4\x22\xb3\xf7\x2b\xf8\x6b\xb3\xa4\x40\x1d\x3f\xcf\xcc\xa2\x90\x53\x28\x56\x0e\xe1\x8e\xa5\x53\x94\xda\xc8\x11\xd5\xd7\xf7\x11\xd8\x99\xd9\x67\xda\x13\x3c\xdb\x8d\xbb\x94\x2a\xbb\x82\x39\x15\xfb\x82\x72\x20\x86\x75\x98\xe1\xd0\xb0\xd2\x31\x2f\xb4\x2c\xdd\xe9\x55\x4f\xd2\x32\x53\xd2\xd8\xfd\x10\xdb\x16\x78\x01\x6b\x66\xbe\x4f\x03\xec\xda\xe0\x89\xf6\xbc\x64\x15\xb1\xdc\x05\xd2\xf7\xaa\x1c\x75\xe7\xe3\x0d\x16\x22\xe8\xba\xab\x9f\x3e\x72\x7f\xfc\xb4\x2d\xdc\x36\xca\x62\x9f\xf3\x61\x3e\x2b\x57\x6c\x5e\x8c\xeb\xb8\xdb\xed\xcd\x2f\x7a\x4e\xf6\x4e\x91\x65\x6b\xdf\x64\x93\xe9\x45\x01\x2c\x0e\x98\xf2\x06\x3c\x4f\x7a\x1b\x07\x08\xf3\x3b\xa3\x4d\x42\xfc\xb3\x73\x11\x8f\xdd\x3d\x6f\xc6\x79\x70\x0b\x6f\xec\x8f\x0d\xba\x34\x85\x1f\x4c\xf0\xdc\x15\xf8\xa3\xd6\x6e\x50\x90\x31\x03\x77\x6b\x94\xb0\x09\x4a\x9a\x1b\xa1\xac\x05\xe3\xc2\x84\xc7\xd4\xfe\x5d\x63\x75\x93\x59\x68\x23\x7a\xba\x12\x69\x42\x0d\x21\x4d\xc1\x27\x4b\x13\x25\x2f\xd1\x4d\x98\xc4\x1d\x43\xad\xe9\xbf\xd2\x91\x8f\xc7\x5b\xe2\x34\x74\x2a\x94\xd6\x13\x03\xbd\x50\x5a\xd4\x05\xcb\x30\xf1\x1d\xbe\x40\x38\xda\x0b\x61\xe9\xef\x2f\x96\x9d\x67\x1f\x4b\xa8\x10\x26\xa8\x75\x12\x4e\x04\x7f\xff\x93\x77\x9a\xd5\x07\x1d\x9a\xe4\xa7\x66\xee\xf1\xf7\x2c\xcf\xde\xd2\x62\x19\xa2\x7d\xe8\x39\x78\xfc\x64\x7e\x55\x73\x06\xd7\x4a\x09\x64\x12\xb8\xcc\x79\xe6\x0b\x7f\xb7\x46\x37\xaa\x47\x75\xa0\x93\x01\x1a\xda\x2c\x48\x18\x02\x7b\x60\x7b\xd1\xd7\x77\xe9\x8c\x13\x6d\x79\xe1\xaa\x7e\x7a\x0a\x92\x3b\x41\xc7\xa0\x82\x09\x83\x44\x91\xd9\x86\x69\x78\x98\x63\x3f\xeb\x42\x79\xce\x0c\x99\x5f\xc1\x5f\xd8\x55\xf3\x52\xd9\x0b\xda\x67\x0f\x70\xc9\xea\x2d\xa5\x63\x15\x14\x68\xb3\x35\x30\x30\x35\x66\xbc\xe0\x19\x6d\x54\xdc\x6e\x81\xc9\x1c\xb8\x85\x3b\x66\x40\x2a\xeb\x17\xe3\x6e\x09\xce\x99\x65\xb4\xbe\x06\xe6\x4d\xfd\xf4\xbc\x9b\x09\x76\x8d\x22\x60\xff\x32\x42\x4d\x2c\x1f\xa0\x53\x57\x82\x78\x78\x40\xbd\x87\x18\xde\x00\x26\xde\xf9\x1b\x88\x87\xf0\xe3\x1e\xf3\xce\xee\x8b\xc0\x1e\xca\x31\x05\xbb\x33\xfa\x3a\x94\x27\x29\x3f\x8d\xf1\x17\x66\x6e\xfa\x6c\x2a\x66\x6e\x08\x2e\x7d\x20\xbe\xf1\xc1\x71\x84\x5d\x7f\x50\x88\xd3\x1c\x96\xe3\x38\x25\x17\x2e\xca\x21\x9e\x81\x64\x57\x5c\x96\x8d\x60\xfa\x79\x3c\x0b\x87\xc7\x3c\xab\x94\x46\xaa\x32\x3d\x4d\xd0\x51\xee\x09\xba\x4d\x3d\xfe\x61\xc6\x4d\x8c\xbf\x86\x74\x5d\xaa\x13\xde\x75\xd6\x5f\x4c\xbd\xa1\x80\xfb\xec\xeb\x4c\xbf\x9a\x80\x93\x0a\x3c\x6b\xce\x7c\x56\x2c\xc7\xc7\x07\x4d\x89\xd6\x65\x90\x13\xd4\x6c\x98\x2c\xc2\x5d\x05\xda\xb7\xd7\x08\xb7\xf4\xc6\x38\x00\x3d\xb6\x3b\xc0\xec\x9e\x5a\xaf\x44\x79\x64\xf9\xf7\x30\x76\xce\x09\x62\xf7\x61\x9a\xc5\x04\x69\xef\xe1\xc5\x38\x87\xba\x3c\x40\xd9\x9b\x7d\x35\xc6\xa3\xfc\x9f\x46\xf8\x9c\xf6\x58\xcd\xb8\xb4\x8f\x42\x9c\x69\x64\x16\xd3\xa6\xce\x69\xeb\xa1\x5e\x56\xda\x37\xb7\x6b\x76\xff\xde\x95\x93\xc1\xb1\xce\xfd\x86\x82\x5c\x43\xd6\x7b\x31\x6e\xb3\xc1\x7c\xf2\xda\xb3\x82\x0d\x57\xc2\xaf\x9f\xaa\xf0\xe5\x57\x9a\xac\xf9\x65\xa8\x91\xfc\xb6\x41\x89\xa6\xdb\x88\xf6\xa3\x1e\x08\x54\x99\xb2\xe3\xcf\xcc\x6d\x1c\x2f\x5f\x7a\xf6\x9c\x3c\x97\x4b\x43\xae\x21\xd5\x8e\x5e\x95\x29\x5f\xbb\x0c\x3d\x08\xe9\xc1\x32\xd4\x03\x9e\x90\xa2\x27\xed\xaf\x60\xfe\x1d\xea\xee\x25\xd6\x68\xec\xc9\xbb\x67\xfe\x75\x14\xde\x33\xf6\x04\x87\xdb\x36\x3d\x02\xbc\xaf\x59\xf7\x54\x04\x62\x88\xa3\x23\x94\x42\x5d\x33\x01\x6b\x14\x35\x6a\x93\x80\xfb\xf9\xae\x7f\x03\x38\xf8\x02\xe0\x9d\xec\x2d\xff\x8f\xbd\xd7\x1d\x78\x1d\x98\x87\x3b\x0f\x7e\xe7\x38\xfc\xca\xe1\x82\xfc\xf3\x2e\xc3\xc7\xbf\x03\x00\x00\xff\xff\x91\x65\x8f\xc9\x71\x15\x00\x00")

func templateBaseTmplBytes() ([]byte, error) {
return bindataRead(
Expand All @@ -141,7 +141,7 @@ func templateBaseTmpl() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "template/base.tmpl", size: 5504, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
info := bindataFileInfo{name: "template/base.tmpl", size: 5489, mode: os.FileMode(420), modTime: time.Unix(1, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down
2 changes: 1 addition & 1 deletion entc/gen/template/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (e *ValidationError) Error() string {

// Unwrap implements the errors.Wrapper interface.
func (e *ValidationError) Unwrap() error {
return errors.Unwrap(e.err)
return e.err
}

// IsValidationError returns a boolean indicating whether the error is a validaton error.
Expand Down
2 changes: 1 addition & 1 deletion entc/integration/config/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/customid/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions entc/integration/ent/schema/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package schema

import (
"errors"
"regexp"
"strings"

Expand All @@ -14,6 +13,15 @@ import (
"github.com/facebook/ent/schema/field"
)

// CheckError is returned by the validators.
type CheckError struct {
msg string
}

func (c CheckError) Error() string {
return c.msg
}

// Group holds the schema for the group entity.
type Group struct {
ent.Schema
Expand All @@ -39,7 +47,7 @@ func (Group) Fields() []ent.Field {
Match(regexp.MustCompile("[a-zA-Z_]+$")).
Validate(func(s string) error {
if strings.ToLower(s) == s {
return errors.New("last name must begin with uppercase")
return CheckError{msg: "last name must begin with uppercase"}
}
return nil
}),
Expand Down
2 changes: 1 addition & 1 deletion entc/integration/gremlin/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/hooks/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/idtype/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions entc/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/facebook/ent/entc/integration/ent/migrate"
"github.com/facebook/ent/entc/integration/ent/node"
"github.com/facebook/ent/entc/integration/ent/pet"
"github.com/facebook/ent/entc/integration/ent/schema"
"github.com/facebook/ent/entc/integration/ent/user"
"github.com/stretchr/testify/mock"

Expand Down Expand Up @@ -578,9 +579,10 @@ func Relation(t *testing.T, client *ent.Client) {
require.Error(err, "type validator failed")
_, err = client.Group.Create().SetInfo(info).SetType("pass").SetName("failed").SetExpire(time.Now().Add(time.Hour)).Save(ctx)
require.Error(err, "name validator failed")
require.IsType(&ent.ValidationError{}, err)
var checkerr schema.CheckError
require.True(errors.As(err, &checkerr))
require.EqualError(err, "ent: validator failed for field \"name\": last name must begin with uppercase")
require.EqualError(errors.Unwrap(err), "last name must begin with uppercase")
require.EqualError(checkerr, "last name must begin with uppercase")
_, err = client.Group.Create().SetInfo(info).SetType("pass").SetName("Github20").SetExpire(time.Now().Add(time.Hour)).Save(ctx)
require.Error(err, "name validator failed")
_, err = client.Group.Create().SetInfo(info).SetType("pass").SetName("Github").SetMaxUsers(-1).SetExpire(time.Now().Add(time.Hour)).Save(ctx)
Expand Down
2 changes: 1 addition & 1 deletion entc/integration/json/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/migrate/entv1/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/migrate/entv2/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/privacy/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/template/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/edgeindex/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/entcpkg/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/m2m2types/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/m2mbidi/ent/ent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0c3ba9b

Please sign in to comment.