We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a schema with invalid default value:
$ defradb client schema add 'type User { name: String, active: Boolean @default(bool: blah)}'
It competes without errors. When you create a doc arterwards:
$ defradb client collection create '{ "name": "John" }'
You get a panic:
panic: interface conversion: interface {} is string, not bool goroutine 1 [running]: github.com/sourcenetwork/defradb/client.getBool({0x108e5b540?, 0x14001d5bcd0?}) github.com/sourcenetwork/defradb/client/document.go:386 +0x94 github.com/sourcenetwork/defradb/client.validateFieldSchema({0x108e5b540, 0x14001d5bcd0}, {{0x14001d71d68, 0x6}, 0x1, {0x10972cfb8, 0x10bd71590}, {0x0, 0x0}, 0x1, ...}) github.com/sourcenetwork/defradb/client/document.go:291 +0xa58 github.com/sourcenetwork/defradb/client.(*Document).Set(0x140012151e0, {0x14001d71d68, 0x6}, {0x108e5b540, 0x14001d5bcd0}) github.com/sourcenetwork/defradb/client/document.go:736 +0x53c github.com/sourcenetwork/defradb/client.(*Document).setDefaultValues(0x140012151e0) github.com/sourcenetwork/defradb/client/document.go:778 +0xb8 github.com/sourcenetwork/defradb/client.newEmptyDoc({{{0x1, {0x14001d71ad0, 0x4}}, 0x1, 0x1, {0x14001d82340, 0x3b}, {0x10beea120, 0x0, 0x0}, ...}, ...}) github.com/sourcenetwork/defradb/client/document.go:109 +0xa8 github.com/sourcenetwork/defradb/client.NewDocFromJSON({_, _, _}, {{{0x1, {0x14001d71ad0, 0x4}}, 0x1, 0x1, {0x14001d82340, 0x3b}, ...}, ...}) github.com/sourcenetwork/defradb/client/document.go:170 +0x4c github.com/sourcenetwork/defradb/cli.MakeCollectionCreateCommand.func1(0x14001d65208, {0x14001d5aa80?, 0x1?, 0x107f2b1bc?}) github.com/sourcenetwork/defradb/cli/collection_create.go:100 +0x26c github.com/spf13/cobra.(*Command).execute(0x14001d65208, {0x14001d5aa50, 0x1, 0x1}) github.com/spf13/[email protected]/command.go:985 +0x840 github.com/spf13/cobra.(*Command).ExecuteC(0x14001d6db08) github.com/spf13/[email protected]/command.go:1117 +0x344 github.com/spf13/cobra.(*Command).Execute(0x10bd03388?) github.com/spf13/[email protected]/command.go:1041 +0x1c main.main() github.com/sourcenetwork/defradb/cmd/defradb/main.go:23 +0x20
Note: With not matching types:
$ defradb client schema add 'type User { name: String, age: Int @default(int: "1")}'
It doesn't panic:
$ defradb client collection create '{ "name": "John" }' Error: unexpected type. Property: field, Expected: int64, Actual: string
But it needs to be caught on schema creation.
The text was updated successfully, but these errors were encountered:
6cc39a7
nasdf
Successfully merging a pull request may close this issue.
Add a schema with invalid default value:
$ defradb client schema add 'type User { name: String, active: Boolean @default(bool: blah)}'
It competes without errors. When you create a doc arterwards:
$ defradb client collection create '{ "name": "John" }'
You get a panic:
Note:
With not matching types:
$ defradb client schema add 'type User { name: String, age: Int @default(int: "1")}'
It doesn't panic:
$ defradb client collection create '{ "name": "John" }' Error: unexpected type. Property: field, Expected: int64, Actual: string
But it needs to be caught on schema creation.
The text was updated successfully, but these errors were encountered: