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

schema with [name: str]: Test = { name = name } is not being populated in the schema #411

Open
eminaktas opened this issue Nov 22, 2024 · 2 comments
Assignees

Comments

@eminaktas
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

It looks like the types captured for TestMap in here, cannot capture Properties.

Screenshot 2024-11-22 at 23 21 10
package main

import (
	"bytes"
	"fmt"
	"os"

	"kcl-lang.io/kcl-go/pkg/tools/gen"
)

const code = `
schema Main:
	maps: TestMap

schema Test:
	name: str
	surname: str

schema TestMap:
	[name: str]: Test = {name = name}
`

func main() {
	var buf bytes.Buffer
	err := gen.GenGo(&buf, fmt.Sprintf("test.k"), code, nil)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	fmt.Println(buf.String())
}

2. What did you expect to see? (Required)

type TestMap map[string]Test

type Test struct {
    name string `kcl:"name=name,type=str"`       // kcl-type: str
    surname string `kcl:"name=surname,type=str"` // kcl-type: str
}

type Main struct {
    maps *TestMap `kcl:"name=maps,type=TestMap"` // kcl-type: TestMap
}

3. What did you see instead (Required)

type TestMap struct {
}

type Test struct {
    name string `kcl:"name=name,type=str"`       // kcl-type: str
    surname string `kcl:"name=surname,type=str"` // kcl-type: str
}

type Main struct {
    maps *TestMap `kcl:"name=maps,type=TestMap"` // kcl-type: TestMap
}

4. What is your KCL components version? (Required)

0.10.10-darwin-arm64

@eminaktas
Copy link
Author

/cc @Peefy

@Peefy
Copy link
Contributor

Peefy commented Nov 29, 2024

Unfortunately, the schema type API does not yet support index signing, and we do not yet support that. cc @zong-zhe @He1pa

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

No branches or pull requests

3 participants