Skip to content

Commit d38ff48

Browse files
committed
chore: add extra docs on previewing open api specs
1 parent cb87209 commit d38ff48

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,27 @@ BREAKING CHANGE: use JavaScript features not available in Node 6
6363
We are using [OpenAPI generator](https://github.com/OpenAPITools/openapi-generator) along with these OAS yaml files to generate our new SDKs.
6464

6565
## Preview
66+
### Online
6667
There are lots of tools available for viewing and editing OpenAPI descriptions in a nicely formatted way. A popular tool is SwaggerHub - a version of which is [hosted here](https://app.swaggerhub.com/home).
6768

6869
Once you sign up or login, you can create a new API under your account and import a Xero API spec.
6970

7071
![SwaggerUI Example](images/import-api.png)
7172

73+
### Local
74+
75+
#### Node.js
76+
If you have Node.js you can use the Swagger UI via an NPM package (it will open a webpage in your default browser):
77+
`npx -y open-swagger-ui --open ./xero_accounting.yaml`
78+
79+
#### Docker
80+
To view a local file via Docker, run:
81+
`docker run -p 8080:8080 -e SWAGGER_JSON=/local/xero_accounting.yaml -v $PWD:/local docker.swagger.io/swaggerapi/swagger-ui`
82+
83+
To view a hosted file via Docker, run:
84+
`docker run -p 8080:8080 -e SWAGGER_JSON_URL=https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_accounting.yaml docker.swagger.io/swaggerapi/swagger-ui`
85+
86+
7287
## Updates
7388
If you find something missing or incorrect please [open an issue](https://github.com/XeroAPI/Xero-OpenAPI/issues/new) or send us a pull request.
7489

0 commit comments

Comments
 (0)