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

Check that generated code can be compiled #23

Open
brandur opened this issue Jun 25, 2014 · 2 comments
Open

Check that generated code can be compiled #23

brandur opened this issue Jun 25, 2014 · 2 comments

Comments

@brandur
Copy link
Member

brandur commented Jun 25, 2014

I've run into a few instances where Schematic will generated something like this:

// Restart formation.
func (s *Service) FormationRestart(appIdentity int, formationIdentity string) (*Formation, error) {
    var formation Formation
    return &formation, s.Post(&formation, fmt.Sprintf("/apps/%v/formations/%v/actions/restart", appIdentity, formationIdentity), o)
}

(Which is Go code that cannot compile.)

It can usually be fixed by tweaking some parameters around in a schema, but it might be cool if Schematic performed some kind of sanity check after generating code.

@cyberdelia
Copy link
Member

Can you provide the compiler error too?

@brandur
Copy link
Member Author

brandur commented Jun 26, 2014

Oh, definitely! It'll look something like this:

kpi/kpi.go:383: undefined: o

Easiest repro is to set a link's rel attribute to anything that Schematic doesn't expect, say "restart". An o for incoming options will get added to the return line, but will not be defined in the function parameters. These non-standard rel values are a little unusual, but I don't think they're restricted in any way.

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