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: export complains when a CUE package, a non-CUE schema, and a data file are combined #3341

Open
jpluscplusm opened this issue Jul 30, 2024 · 0 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@jpluscplusm
Copy link
Collaborator

What version of CUE are you using (cue version)?

$ cue version
cue version v0.9.2

go version go1.22.4
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.9.2

Does this issue reproduce with the latest stable release?

v0.9.2 is latest.

What did you do?

# 1
exec cue export package.cue
cmp stdout gold

# 2
exec cue export package.cue schema.json
cmp stdout gold

# 3
exec cue export package.cue schema.json data.yml
cmp stdout gold

# 4
exec cue export .:a
cmp stdout gold

# 5
exec cue export .:a schema.json
cmp stdout gold

# 6
exec cue export .:a schema.json data.yml
cmp stdout gold
-- package.cue --
package a

x: "foo"
-- schema.json --
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object",
  "properties": { "x": { "type": "string", "minLength": 1 } } }
-- data.yml --
x: "foo"
-- gold --
{
    "x": "foo"
}

What did you expect to see?

Ideally: a passing test (because there's no meaningful difference (to the consumer!) between command #3 and command #6)

Failing that: a better error message (because the addition of the data file seems unrelated to the error message, which feels like it should have been triggered by command #5, if it were true)

What did you see instead?

# 1 (0.026s)
# 2 (0.049s)
# 3 (0.039s)
# 4 (0.051s)
# 5 (0.063s)
# 6 (0.056s)
> exec cue export .:a schema.json data.yml
[stderr]
cannot combine packages with individual schema files
[exit status 1]
FAIL: /tmp/testscript538769625/cue.export.cannotCombinePackageWithSchemaFile.txtar/script.txtar:22: unexpected command failure
@jpluscplusm jpluscplusm added NeedsInvestigation Triage Requires triage/attention labels Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant