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

[PoC] Use cog to generate go and typescript models + resources #296

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

K-Phoen
Copy link
Member

@K-Phoen K-Phoen commented May 29, 2024

Draft PR meant to try out cog as a potential replacement for Go and Typescript codegen purposes.

ToDo:

  • the thema.CustomKindParser provided by grafana-app-sdk used with cog's CUE parser struggle to correctly handle references to objects defined "above" the currently parsed root. Ex:
    #InnerObject2: { // ← object defined "above" the current root
        name: string
        details: {
            [string]: _
        }
    }
    
    spec: { // ← current root
        inner: #InnerObject1
        // ...
    }
    Cog detects this case correctly, gets the path to InnerObject2 (something like customKind.lineage._sortedSchemas[1]._#schema.#InnerObject2), but resolving this path (with LookupPath() fails on hidden fields introduced by thema (_sortedSchemas and _#schema).
    If thema support isn't meant to stick around long-term, this issue might not be worth solving.

Note: this PR isn't necessarily meant to be finished or merged, it's more a sandbox to play with cog + grafana-app-sdk.

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 this pull request may close these issues.

None yet

1 participant