Skip to content

Commit a53fe40

Browse files
committed
Update README with full instructions to regenarate both swagger tool and client
1 parent b12995d commit a53fe40

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

README.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,46 @@ This client code was generated by the [go-swagger tool](https://github.com/go-sw
5353

5454
We use a modified generator and templates to generate the client, and the [sources are here](https://github.com/killbill/go-swagger).
5555

56-
To generate:
56+
As explained in the [commit](https://github.com/killbill/go-swagger/commit/4d48bffe307c6043daccf5144b132c55cc783803), we are stuck
57+
on an older version of `go-swagger`, i.e our fork is not up to date with parent. In addition to this, there is an [issue](https://github.com/go-swagger/go-swagger/issues/2215) compiling
58+
the tool with recent version of go, and so we are aldo currently stuck using go <= 1.13 -- for building the tool itself, i.e the swagger generator.
59+
60+
To download/install GO 1.13, follow the steps from [here](https://golang.org/doc/manage-install), or simply:
61+
62+
```bash
63+
# This will install the tool under ~/sdk by default
64+
go get golang.org/dl/go1.13
65+
go1.13 download
66+
67+
# You can then set GOROOT=~/sdk/go1.13 in your shell or inside Goland 's preference (for the project)
68+
```
69+
70+
To build the (custom) swagger generator
5771

5872
```bash
59-
# Update swagger.json
60-
curl http://localhost:8080/swagger.json | jq "." >swagger.json
73+
74+
# Pre-requisite (needed if template changes)
75+
brew install go-bindata
6176

6277
# Install swagger tool
6378
mkdir -p $GOPATH/src/github.com/go-swagger
6479
cd $GOPATH/src/github.com/go-swagger
6580
git clone git@github.com:killbill/go-swagger.git
6681

67-
# Required each time the templates change
68-
go install github.com/go-swagger/go-swagger/cmd/swagger
82+
# Each time the templates change, following 2 steps are needed:
83+
84+
#1. Regenerate the (template) byte code inside the go-swagger code itself -> generator/bindata.go should be modified
85+
go1.13 generate ./generator
86+
87+
#2. build the binary
88+
go1.13 build cmd/swagger/swagger.go && cp swagger cp ./swagger $GOPATH/bin/swagger
89+
```
90+
91+
Finally, in order to generate the killbill client (using the custom `swagger` generator):
6992

70-
# You must be in $GOPATH/src to regenerate the files, consider creating a symlink in
71-
# ln -s /path/to/killbill/go-swagger go-swagger
72-
cd $GOPATH/src/github.com/killbill/kbcli
93+
```bash
94+
# Update swagger.json
95+
curl http://localhost:8080/swagger.json | jq "." >swagger.json
7396

7497
# Regenerate the tool
7598
swagger generate client -f swagger.json -m kbmodel -c kbclient --default-scheme=http

0 commit comments

Comments
 (0)