Skip to content

Parse error on non typed types #53

@gottafixthat

Description

@gottafixthat

First off, thanks for the package. I've been evaluating it and I think it can work for me, which would save me a ton of time.

I'm running into a few issues, though, and this seems related to #27 since I was able to use the same workaround, but this fails to parse:

// UserProfile represents the user profile
type UserProfile struct {
	ID          int32             `json:"id"`
	Email       string            `json:"email"`
	Name        null.Val[string]  `json:"name"`
	Phone       null.Val[string]  `json:"phone"`
	Avatar      null.Val[string]  `json:"avatar"`
	Roles       []rbac.Role       `json:"roles"`
	Permissions []rbac.Permission `json:"permissions"`
}

But updating it to this, it parses fine:

type roles []rbac.Role
type permissions []rbac.Permission
type nullstring null.Val[string]

// UserProfile represents the user profile
type UserProfile struct {
	ID          int32       `json:"id"`
	Email       string      `json:"email"`
	Name        nullstring  `json:"name"`
	Phone       nullstring  `json:"phone"`
	Avatar      nullstring  `json:"avatar"`
	Roles       roles       `json:"roles"`
	Permissions permissions `json:"permissions"`
}

Unfortunately, refactoring to use typed values like this won't work for me since I have a bunch of generated models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions