Open bodymindarts opened 8 years ago
I'm not sure of your specific usecase here, but if you build the ramlgen package (from within the ramlgen directory) i.e. ramlgen git:(master) ✗ godep go build
then generate your handlers ramlgen git:(master) ✗ ./ramlgen my-api.raml
you should be good to go.
The problem you're seeing here is because godep go run ramlgen/main.go
isn't pulling the const values from the template
using godep go build
from the ramlgen
directory resolves the issue with the constants but not with the inconsistency of the struct definition. I still get this output:
./main.go:11: inconsistent definition for type raml.APIDefinition during import
struct { RAMLVersion string "yaml:\"raml_version\""; Title string "yaml:\"title\""; Version string "yaml:\"version\""; BaseUri string; BaseUriParameters map[string]raml.NamedParameter "yaml:\"baseUriParameters\""; UriParameters map[string]raml.NamedParameter "yaml:\"uriParameters\""; Protocols []string "yaml:\"protocols\""; MediaType string "yaml:\"mediaType\""; Schemas []map[string]string; SecuritySchemes []map[string]raml.SecurityScheme "yaml:\"securitySchemes\""; SecuredBy []raml.DefinitionChoice "yaml:\"securedBy\""; Documentation []raml.Documentation "yaml:\"documentation\""; Traits []map[string]raml.Trait "yaml:\"traits\""; ResourceTypes []map[string]raml.ResourceType "yaml:\"resourceTypes\""; Resources map[string]raml.Resource "yaml:\",regexp:/.*\"" } (in "github.com/EconomistDigitalSolutions/ramlapi")
struct { RAMLVersion string "yaml:\"raml_version\""; Title string "yaml:\"title\""; Version string "yaml:\"version\""; BaseUri string "yaml:\"baseUri\""; BaseUriParameters map[string]raml.NamedParameter "yaml:\"baseUriParameters\""; UriParameters map[string]raml.NamedParameter "yaml:\"uriParameters\""; Protocols []string "yaml:\"protocols\""; MediaType string "yaml:\"mediaType\""; Schemas []map[string]string; SecuritySchemes []map[string]raml.SecurityScheme "yaml:\"securitySchemes\""; SecuredBy []raml.DefinitionChoice "yaml:\"securedBy\""; Documentation []raml.Documentation "yaml:\"documentation\""; Traits []map[string]raml.Trait "yaml:\"traits\""; ResourceTypes []map[string]raml.ResourceType "yaml:\"resourceTypes\""; Resources map[string]raml.Resource "yaml:\",regexp:/.*\"" } (in "github.com/buddhamagnet/raml")
godep: go exit status 2
Perhaps it has to do with the yaml dependency, when trying to check out the hash specified in Godep.json i get fatal: reference is not a tree: e401b2b026855a4fa8e7014d553ae5bdfccb21cd
looks like the git history has been rewritten.
@bodymindarts had a quick look at this, could you switch to the dependencies/yaml
branch and let me know if this resolves the issue, thanks!
Sorry @buddhamagnet no difference:
~/golang/src/github.com/EconomistDigitalSolutions/ramlapi/ramlgen (dependencies/yaml=) % godep go build
# github.com/EconomistDigitalSolutions/ramlapi/ramlgen
./main.go:11: inconsistent definition for type raml.APIDefinition during import
struct { RAMLVersion string "yaml:\"raml_version\""; Title string "yaml:\"title\""; Version string "yaml:\"version\""; BaseUri string; BaseUriParameters map[string]raml.NamedParameter "yaml:\"baseUriParameters\""; UriParameters map[string]raml.NamedParameter "yaml:\"uriParameters\""; Protocols []string "yaml:\"protocols\""; MediaType string "yaml:\"mediaType\""; Schemas []map[string]string; SecuritySchemes []map[string]raml.SecurityScheme "yaml:\"securitySchemes\""; SecuredBy []raml.DefinitionChoice "yaml:\"securedBy\""; Documentation []raml.Documentation "yaml:\"documentation\""; Traits []map[string]raml.Trait "yaml:\"traits\""; ResourceTypes []map[string]raml.ResourceType "yaml:\"resourceTypes\""; Resources map[string]raml.Resource "yaml:\",regexp:/.*\"" } (in "github.com/EconomistDigitalSolutions/ramlapi")
struct { RAMLVersion string "yaml:\"raml_version\""; Title string "yaml:\"title\""; Version string "yaml:\"version\""; BaseUri string "yaml:\"baseUri\""; BaseUriParameters map[string]raml.NamedParameter "yaml:\"baseUriParameters\""; UriParameters map[string]raml.NamedParameter "yaml:\"uriParameters\""; Protocols []string "yaml:\"protocols\""; MediaType string "yaml:\"mediaType\""; Schemas []map[string]string; SecuritySchemes []map[string]raml.SecurityScheme "yaml:\"securitySchemes\""; SecuredBy []raml.DefinitionChoice "yaml:\"securedBy\""; Documentation []raml.Documentation "yaml:\"documentation\""; Traits []map[string]raml.Trait "yaml:\"traits\""; ResourceTypes []map[string]raml.ResourceType "yaml:\"resourceTypes\""; Resources map[string]raml.Resource "yaml:\",regexp:/.*\"" } (in "github.com/buddhamagnet/raml")
godep: go exit status 2
@bodymindarts haven't forgotten this, sorry for the delay, life keeps getting in the way.
godep go run ramlgen/main.go
results in