Skip to content

Commit ed6d5f9

Browse files
committed
update docs for clarity and add envs
1 parent 76a9a0f commit ed6d5f9

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

docs/src/open-api-docs.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ The project automatically publishes API documentation to GitHub Pages:
1515
- **OpenAPI/Swagger UI**: https://mozilla-services.github.io/syncstorage-rs/swagger-ui/
1616

1717
#### When the service is running (live deployment):
18+
It is suggested to use the stage instance of Sync when playing with the API,
19+
though you may also interact with your data in the production instance.
1820

21+
The Prod and Stage environments below will be available as a drop-down in the SwaggerUI:
22+
- **Stage**: `https://sync-us-west1-g.sync.services.allizom.org`.
23+
- **Prod**: `https://sync-1-us-west1-g.sync.services.mozilla.com`.
24+
25+
URLs for Swagger and OpenAPI Spec:
1926
- **Swagger UI (Interactive)**: `https://<your-deployment-url>/swagger-ui/`
2027
- **OpenAPI Spec (JSON)**: `https://<your-deployment-url>/api-doc/openapi.json`
2128

@@ -69,11 +76,12 @@ When adding new endpoints:
6976
4. Run `cargo run --example generate_openapi_spec` to verify the spec generates correctly. Follow instructions below.
7077

7178
### Generating the OpenAPI Spec Locally
79+
If you don't want to compile the Sync server on your machine to view the API docs, follow these instructions:
7280

7381
#### Use `make api-prev`
7482
We created a handy Makefile command called `make api-prev` that automatically generates the specification file, runs Swagger in Docker and opens your browser to `localhost:8080`. See the steps below to understand this process. Note this attempts to be platform agnostic, but might require some adaptation depending on your operating system.
7583

76-
You can generate the OpenAPI specification without running the server:
84+
Commands to generate the OpenAPI specification without running the server:
7785

7886
```bash
7987
# Generate the spec to stdout
@@ -83,29 +91,22 @@ cargo run --example generate_openapi_spec
8391
cargo run --example generate_openapi_spec > openapi.json
8492
```
8593

86-
### Viewing the Spec Locally (Without Running the Server)
87-
88-
If you don't want to compile the server on your machine, you can still view the API documentation:
89-
90-
1. **Use Docker** (simplest):
94+
Other options:
95+
1. **Use Docker** (simplest - used in `make api-prev`):
9196
This option requires you to have run `cargo run --example generate_openapi_spec > openapi.json`.
97+
9298
```bash
9399
docker run -p 8080:8080 -e SWAGGER_JSON=/openapi.json -v $(pwd)/openapi.json:/openapi.json swaggerapi/swagger-ui
94100
```
95101
Then open http://localhost:8080
96102

97-
2. **Generate the spec on a compatible machine** (or use CI):
98-
```bash
99-
cargo run --example generate_openapi_spec > openapi.json
100-
```
101-
102-
3. **Use online Swagger Editor**:
103+
2. **Use online Swagger Editor**:
103104
- Go to https://editor.swagger.io/
104105
- Copy the contents of `openapi.json`
105106
- Paste into the editor
106107
- View the interactive documentation
107108

108-
4. **Use VS Code extension**:
109+
3. **Use VS Code extension**:
109110
- Install "OpenAPI (Swagger) Editor" extension
110111
- Open `openapi.json` in VS Code
111112
- Click "Preview Swagger" to view interactive docs

syncserver/src/server/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub fn cfg_path(path: &str) -> String {
8787
description = "OpenAPI documentation for Syncstorage and Tokenserver endpoints."
8888
),
8989
servers(
90+
(url = "https://sync-us-west1-g.sync.services.allizom.org", description = "US West Stage"),
9091
(url = "https://sync-1-us-west1-g.sync.services.mozilla.com", description = "US West Production"),
9192
),
9293
paths(

0 commit comments

Comments
 (0)