@corralimited/snapdiff-openapi
v0.2.1
Published
Versioned OpenAPI 3.1 specification for the SnapDiff REST API. Use as a codegen input for typed clients (openapi-typescript, openapi-fetch, orval, kiota, etc).
Maintainers
Readme
@corralimited/snapdiff-openapi
Versioned OpenAPI 3.1 specification for the SnapDiff REST API.
Each release of this package corresponds to a specific live-API revision — pin to a version, codegen against it, and your generated client stays in sync until you bump the dep.
Install
npm install --save-dev @corralimited/snapdiff-openapiUse as codegen input
# Generate TypeScript types
npx openapi-typescript node_modules/@corralimited/snapdiff-openapi/openapi.json -o src/snapdiff-types.ts
# Generate orval clients
npx orval --input node_modules/@corralimited/snapdiff-openapi/openapi.json --output src/api/
# Pair openapi-typescript + openapi-fetch for runtime callsimport createClient from 'openapi-fetch';
import type { paths } from './snapdiff-types';
const client = createClient<paths>({
baseUrl: 'https://api.snapdiff.ai/v1',
headers: { 'X-API-Key': process.env.SNAPDIFF_API_KEY! },
});
const { data, error } = await client.POST('/diff', {
body: { before: 'https://prod.example.com', after: 'https://staging.example.com' },
});Use the spec object directly
import { openapiSpec } from '@corralimited/snapdiff-openapi';
// or default import:
import spec from '@corralimited/snapdiff-openapi';
console.log(spec.info.version); // matches the live API minor versionVersioning
Follows semver against API behavior:
- Patch — backwards-compatible spec corrections (description tweaks, examples).
- Minor — new endpoints, new optional fields, new optional query params.
- Major — breaking changes (removed endpoints, required fields added, response shape
changes). Major bumps coincide with versioned API roots (
/v1→/v2).
Live spec
The same spec is also served live at https://api.snapdiff.ai/openapi.json — useful for exploration. For reproducible CI builds, prefer this package.
License
MIT — see LICENSE.
