OpenAPI Access
What This Page Answers
Section titled “What This Page Answers”SyncTV includes built-in OpenAPI documentation, but it is only available when the binary is built with the openapi feature.
Use this page to find where Swagger UI and the OpenAPI JSON are served. It does not claim that every endpoint is complete or stable.
Enable OpenAPI
Section titled “Enable OpenAPI”Run locally with OpenAPI:
cargo run -p synctv --features openapi --bin synctv -- serveWith an explicit config file:
cargo run -p synctv --features openapi --bin synctv -- serve --config synctv.yamlBuild check:
cargo check --workspace --all-targets --features openapiSwagger UI
Section titled “Swagger UI”After startup:
http://localhost:8080/swagger-ui/If server.port is changed, replace 8080.
Production example:
https://api.example.com/swagger-ui/OpenAPI JSON
Section titled “OpenAPI JSON”JSON document:
http://localhost:8080/api-docs/openapi.jsonExport:
curl -fsSL http://localhost:8080/api-docs/openapi.json -o openapi.jsonAuthenticated business APIs use Bearer Token security in the OpenAPI document. Public APIs are marked accordingly.
Generate Clients
Section titled “Generate Clients”TypeScript types:
npx openapi-typescript http://localhost:8080/api-docs/openapi.json -o synctv-api.d.tsOpenAPI Generator:
openapi-generator-cli generate \ -i http://localhost:8080/api-docs/openapi.json \ -g typescript-fetch \ -o ./generated/synctv-clientOther compatible tools include orval and Kiota.
Deployment Notes
Section titled “Deployment Notes”If production should expose Swagger UI:
- Build the binary with the
openapifeature. - Allow
/swagger-ui/through the reverse proxy. - Allow
/api-docs/openapi.jsonthrough the reverse proxy. - Restrict access at Ingress, Nginx, gateway, or firewall level if only internal developers should access it.
If you do not want to expose API structure in production, build without the openapi feature and enable it only in development or staging.