syncthing-openapi
v1.0.0
Published
OpenAPI specification for the Syncthing REST API.
Readme
Syncthing OpenAPI
OpenAPI 3.1 specification and generated TypeScript types for the Syncthing REST API.
This repository packages the Syncthing API definition in both JSON and YAML formats, along with generated TypeScript types for use in API clients, SDKs, validation, and documentation tooling.
Installation
npm install syncthing-openapiUsage
Import the OpenAPI schema
// ESM
import schema from 'syncthing-openapi';
// CommonJS
const schema = require('syncthing-openapi');Or import the bundled JSON directly:
import schema from 'syncthing-openapi/openapi.json';The YAML version is also included in the package as openapi.yaml.
TypeScript types
This package includes auto-generated TypeScript types from the OpenAPI spec:
import type { paths, operations, components } from 'syncthing-openapi';
type SystemVersionResponse =
paths['/rest/system/version']['get']['responses']['200']['content']['application/json'];
type DbFileQuery = operations['getRestDbFile']['parameters']['query'];Works well with clients like openapi-fetch:
import createClient from 'openapi-fetch';
import type { paths } from 'syncthing-openapi';
const client = createClient<paths>({ baseUrl: 'http://localhost:8384' });
const { data, error } = await client.GET('/rest/system/version');Files
| File | Description |
|------|-------------|
| openapi.yaml | Source OpenAPI 3.1 specification |
| openapi.json | Bundled OpenAPI 3.1 specification in JSON format |
| types.d.ts | Generated TypeScript type definitions |
Development
openapi.yaml is the source of truth. Regenerate derived artifacts with:
npm run gen
npm run gen:json
npm run gen:typesLicense
MIT
