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

Import Mapping Fails for CUE standard library imports #103

Open
IfSentient opened this issue May 15, 2023 · 1 comment
Open

Import Mapping Fails for CUE standard library imports #103

IfSentient opened this issue May 15, 2023 · 1 comment
Labels
kind/bug Something isn't working

Comments

@IfSentient
Copy link

When creating a lineage which imports a piece of the CUE standard library, such as time, cuetsy errors on codegen with:

generating TS for child elements of schema failed: a corresponding typescript import is not available for "time" for input "customkind"

Example CUE lineage file:

package foo

import (
    "time"
    "github.com/grafana/thema"
)

customKind: thema.#Lineage & {
    name: "customkind"
    schemas: [{
        version: [0,0]
        schema: {
            spec: {
                timestamp: string & time.Time @cuetsy(kind="string")
            }
        }
    }]
}

Currently, this can be remedied with a custom import mapper in the cuetsy.Config, or using cuetsy.IgnoreImportMapper, so it doesn't block codegen.

@sdboyer sdboyer added the kind/bug Something isn't working label May 15, 2023
@sdboyer
Copy link
Contributor

sdboyer commented May 15, 2023

Thanks for the issue!

IMO the simplest fix here is probably just not calling the provided ImportMapper func for all cue stdlib package imports. If needed, we could allow also providing mappings for stdlib packages in a later change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants