M README.md +31 -3
@@ 10,15 10,43 @@ v1.2](https://github.com/wordnik/swagger
specification and builds a library for interfacing with that Swagger service,
including all defined data types and structures.
+Installation
+------------
+
+ go get bitbucket.org/seanerussell/sashay/cmd/sashay
+
+Usage
+-----
+
+ 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
-------
- swagger http://petstore.swagger.wordnik.com/api/api-docs petstore
+ 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.
+interact with the Swagger sample application. Use this generated library like this;
+
+ package main
+
+ 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)
+ }
License
-------
-This software is released under the BSD Simplified license.
+This software is released under the BSD Simplified license. See the included file LICENSE.txt
M doc.go +1 -4
@@ 5,9 5,6 @@
/*
* Sashay is a library and command for turning Swagger JSON into Go code.
*
- * Installation:
- * go get bitbucket.org/seanerussell/sashay/cmd/sashay
- *
* Usage:
* sashay <-f> <-u> <-p>
* -f="": API specification JSON file
@@ 16,7 13,7 @@
* Either -f or -u must be provided, and only one can be. -p must be provided.
*
* Example:
- * go run cmd/sashay/main.go -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
*
* Then:
* package main