tkrajina/typescriptify-golang-structs

Trying to convert the models from https://github.com/chargebee/chargebee-go

morrislaptop opened this issue · 4 comments

Having some trouble? panic: cannot find type for ptr (addons/)

The chargebee-go repository has a model package with 40 subpackages. There is no addons/ folder at all there (there is only addon) and I don't have the time to go through all of the modelssubpackage to find out which one isn't working.

Please, provide a code (including the model) or command needed to reproduce the bug.

Here you go...

package main

import "github.com/tkrajina/typescriptify-golang-structs/typescriptify"
import (
	// "../chargebee-go/models/subscription"
	"github.com/chargebee/chargebee-go/models/subscription"
)

func main() {
	converter := typescriptify.New()
	converter.CreateFromMethod = false
	converter.Indent = "    "
	converter.BackupDir = ""

	converter.Add(subscription.CreateForCustomerRequestParams{})

	err := converter.ConvertToFile("example/example.ts")
	if err != nil {
		panic(err.Error())
	}
}

Thanks!

OK, so, the problem here is that this project doesn't work with arrays to pointers. I pushed a quick quick implementation for this feature in the array-ptrs branch. But I need to fix a few test before merging it to master.

There is another problem. Your models also contain maps. There is an experimental support for maps in the maps branch. You can also use maps if you specify a ts_type tag directly in your models (see the example in README.md) but since your models are in another project, this could be a problem.

Duplicate of #12 and will be fixed when #18 is merged.