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

confusing docs for BuildsFrom #149

Open
jeffwillette opened this issue May 9, 2017 · 1 comment
Open

confusing docs for BuildsFrom #149

jeffwillette opened this issue May 9, 2017 · 1 comment

Comments

@jeffwillette
Copy link
Contributor

jeffwillette commented May 9, 2017

I am a bit confused on what I should do with BuildsFrom since the docs seem to say that I can put a raw type identifier in there...

DOCS

func BuildsFrom

func BuildsFrom(dsl func())
BuildsFrom informs Gorma that this model will be populated from a Goa UserType. Conversion functions will be generated to convert from the payload to the model.

Usage: BuildsFrom(YourType)

Fields not in YourType that you want in your model must be added explicitly with the Field DSL.

If I try BuildsFrom(Type) I get the following error:

/design/models_design.go:61: cannot use Document (type *design.UserTypeDefinition) as type func() in argument to dsl.BuildsFrom

I know BuildsFrom is generally used like below, but would like some clarification

BuildsFrom(func() {
    Payload("[resource]", "[action]")
})
@josephbuchma
Copy link

josephbuchma commented Sep 17, 2017

I think it would be much cleaner to use type directly instead of resource-action pair.
e.g

BuildsFrom(func() {
    Payload(User) // instead of Payload("user", "update")
})

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

2 participants