Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Tags across packages #1070

Closed
maurerbot opened this issue Jun 22, 2021 · 3 comments
Closed

Tags across packages #1070

maurerbot opened this issue Jun 22, 2021 · 3 comments

Comments

@maurerbot
Copy link

maurerbot commented Jun 22, 2021

cue seems to be unable to pick up tags across packages.

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

cue version v0.4.0 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

cue/cue.mod/module.cue
module: my.tld

cue/schema/base/base.cue

package base

#metadata: {
	name:         string @tag(name)
	description?: string
}

let Spec = {}

#base: {
	apiVersion: string
	kind:       string
	metadata:   #metadata
	spec?:      Spec
}

cue/schema/v1alpha1/test.cue

package v1alpha1

import "my.tld/schema/base"

let Spec = {
	keys?: [...{
		name: string
		pk:   =~"([a-zA-Z0-9_-]){8,256}"
	}]
} 

test: base.#base & {
	kind:       "test"
	apiVersion: "my.tld/v1alpha1"
	spec: Spec
}
cue eval ./schema/v1alpha1/... -t name="foo" -p v1alpha1 -e test --out=yaml

What did you expect to see?

apiVersion: "my.tld/v1alpha1"
kind:       test
metadata: 
    name: foo

spec: {...}

What did you see instead?

no tag for "name"

Alternatively

cue eval ./schema/... -t name="foo"
#metadata: {
    name: "foo"
}
#base: {
    apiVersion: string
    kind:       string
    metadata: {
        name: "foo"
    }
}
// ---
test: {
    apiVersion: "my.tld/v1alpha1"
    kind:       "test"
    metadata: {
        name: string // this isn't picked up
    }
    spec: {}
}

Other Questions

  • Not sure if leveraging the lattice values as a means to define Spec is the right approach
@maurerbot
Copy link
Author

Adding test:metadata:name: string @tag(name) to test.cue seems to work but feels off to me.

@verdverm
Copy link
Contributor

Related is #1005

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#1070.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

@cueckoo cueckoo closed this as completed Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants