@@ 18,33 18,33 @@ Installation
Usage
-----
- sashay <-f> <-u> <-p>
- -f="": API specification JSON file
- -p="": API package
- -u="": API specification URL
+ sashay <-f> <-u> <-p>
+ -f="": API specification JSON file
+ -p="": API package
+ -u="": API specification URL
Either -f or -u must be provided, and only one can be. -p must be provided.
Example
-------
- sashay -u http://petstore.swagger.wordnik.com/api/api-docs -p petstore > petstore.go
+ sashay -u http://petstore.swagger.wordnik.com/api/api-docs -p petstore > petstore.go
will generate a Go library called "petstore" which can be imported and used to
interact with the Swagger sample application. Use this generated library like this;
- package main
+ package main
- import "petstore"
+ import "petstore"
- func main() {
- pet, err := petstore.GetPetById(33)
- if err != nil {
- log.Println("error fetching pet:", err.Error())
- return
- }
- log.Println("Pet's name is", pet.Name)
- }
+ func main() {
+ pet, err := petstore.GetPetById(33)
+ if err != nil {
+ log.Println("error fetching pet:", err.Error())
+ return
+ }
+ log.Println("Pet's name is", pet.Name)
+ }
License
-------