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

cmd/cue: closedness rules not observed for individual files specified on command line #2214

Open
mpvl opened this issue Jan 13, 2023 Discussed in #2211 · 1 comment
Open
Labels
NeedsFix tooling Triage Requires triage/attention

Comments

@mpvl
Copy link
Member

mpvl commented Jan 13, 2023

Discussed in #2211

Originally posted by sahroshan January 11, 2023
Hi All,
I have been trying to use cue to valiidate another cue. Cuelang report errors for defined keys. But not when there is an extra key at root level. Below are the steps to reproduce it.

steps to reproduce

  1. create a schema file
-- schema.cue
#Config: close({
	foo: close({
		bar: string | *"default from schema"
	})
})

#Config
  1. create simple cue file
-- sub.cue
extra: "this extra field"
  1. run vet command cue vet sub.cue schema.cue

expected

error extra field found in cue

got

cue vet exits without any error

Am i doing something wrong here? Please suggest possible fixes or workarounds

@mpvl
Copy link
Member Author

mpvl commented Jan 13, 2023

Reproducer:

! exec cue vet schema.cue sub.cue
cmp stderr expect-stderr
-- schema.cue --
package schema // should also fail without this package clause
#Config: {
	foo: {
		bar: string | *"default from schema"
	}
}
#Config

-- sub.cue --
extra: "this extra field"

-- expect-stderr --
extra: field not allowed:
    ./schema.cue:1:1
    ./schema.cue:2:10
    ./schema.cue:7:1
    ./sub.cue:1:1

@myitcv myitcv added the zGarden label Jun 13, 2023
@myitcv myitcv added Triage Requires triage/attention and removed zGarden labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix tooling Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

2 participants