Skip to content
New issue

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

validation file referencing schema using schemaFile cannot be imported #460

Open
h3adache opened this issue Jan 28, 2025 · 3 comments · Fixed by #461
Open

validation file referencing schema using schemaFile cannot be imported #460

h3adache opened this issue Jan 28, 2025 · 3 comments · Fixed by #461

Comments

@h3adache
Copy link

The new schemaFile syntax added in #455 is very nice but breaks imports.

zed import studio-entitlements-admin-server/src/main/resources/authzed/schema.zed.yaml
panic: interface conversion: interface {} is *decode.SchemaRelationships, not *validationfile.ValidationFile

goroutine 1 [running]:
github.com/authzed/zed/internal/decode.unmarshalAsYAMLOrSchemaWithFile({0x1400016e000, 0x3b8e, 0x4000}, {0x101b38340, 0x140000a8640}, {0x16f32a0e3, 0x4b})
        internal/decode/decoder.go:116 +0x224
github.com/authzed/zed/internal/decode.DecoderForURL.fileDecoder.func2({0x101b38340, 0x140000a8640})
        internal/decode/decoder.go:62 +0x9c
github.com/authzed/zed/internal/cmd.importCmdFunc(0x1028c4940, {0x140003c1c50, 0x1, 0x1?})
        internal/cmd/import.go:80 +0xa8
github.com/spf13/cobra.(*Command).execute(0x1028c4940, {0x140003c1c20, 0x1, 0x1})
        /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x140002da008)
        /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1034
github.com/authzed/zed/internal/cmd.Run()
        internal/cmd/cmd.go:134 +0x7a8
main.main()
        cmd/zed/main.go:6 +0x1c

I suppose composable schema support would also fix this but just adding it in case it's something quick to support :)

@tstirrat15
Copy link
Contributor

@h3adache is this specifically for a validation file that includes a schemaFile reference? I'm having trouble reproducing with a normal playground file.

@tstirrat15
Copy link
Contributor

Gonna reopen until we get confirmation that it's fixed.

@h3adache
Copy link
Author

h3adache commented Jan 30, 2025

@tstirrat15 yup!
Sorry I updated the title to be more clear.

Seems like 0.26.0 fixed it for schemas but adds an extra prefix for relationships

zed import --schema=false --relationships=true schema.zed.yaml
1:14PM ERR terminated with errors error="rpc error: code = FailedPrecondition desc = object definition `studio/studio/permissions` not found"

@h3adache h3adache changed the title schemaFile breaks import validation file referencing schema using schemaFile cannot be imported Jan 30, 2025
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 a pull request may close this issue.

2 participants