Skip to content

Commit 5909ced

Browse files
committed
Add node client info
1 parent ef35c7d commit 5909ced

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.iml
22
vendor
3+
node

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
CHECK_FILES?=$$(go list ./... | grep -v /vendor/)
33

44

5+
6+
57
help: ## Show this help.
68
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
79

@@ -22,3 +24,6 @@ test: ## Test the go code.
2224

2325
validate: ## Check that the swagger spec is valid.
2426
swagger validate swagger.yml
27+
28+
node: ## Generate the node module.
29+
swagger-codegen generate -i ./swagger.yml -l javascript -o ./node/

README.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Introduction
1+
# Netlify open-api
22

33
This repository contains Netlify's API definition in the [Open API format](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md), formerly known as Swagger.
44

55
It's still a work in progress and we welcome feedback and contributions.
66

7-
## Installation
7+
## Go Client
88

99
We use [go-swagger](https://github.com/go-swagger/go-swagger) to validate our spec against the 2.0 spec of Open API.
1010

1111
We currently depend on version 0.12.0 of the swagger toolchain. You can download the binary for your platform from this release page:
1212

1313
https://github.com/go-swagger/go-swagger/releases/tag/0.12.0
1414

15-
## Spec validation
15+
### Spec validation
1616

1717
You can run this command to validate the spec:
1818

1919
make validate
2020

21-
## Code generation
21+
### Code generation
2222

2323
Currently, we're generating client code for Go, but we're planning on releasing libraries in any language that can generate code from the spec.
2424

@@ -28,6 +28,33 @@ You can use this command to generate the Go client:
2828

2929
You may first want to edit swagger.yml to add your field or endpoint definitions.
3030

31+
## Node Client
32+
33+
In order to generate the Node client, you must install Java 8 and the swagger-codegen tool.
34+
35+
1. You will need java8 (or 7) to run the code-gen
36+
37+
```bash
38+
# install java 8 via homebrew
39+
brew cask install homebrew/cask-versions/java8
40+
```
41+
42+
43+
2. Then install swagger codegen
44+
45+
```bash
46+
# install code-gen via homebrew
47+
brew install swagger-codegen
48+
```
49+
50+
3. Generate the library
51+
52+
```console
53+
$ make node
54+
```
55+
56+
The `swagger-codegen` generates an entire module in the `node` folder. You can publish ne versions of this client from that folder with `npm publish`.
57+
3158
## Explore API
3259

3360
Go to https://open-api.netlify.com to explore the spec definitions using Open-Api's UI.

0 commit comments

Comments
 (0)