TypeScript types for OpenAPI 3.1
OpenAPI 3.1 types for TypeScript with a focus on making it customizable and to reuse some types definitions parts (all sub types defined are exported).
The JSON schema definition is parametrized so that you can use your own definitions and extensions :
import { type JsonValue } from 'type-fest';
import { type ExpressiveJSONSchema } from 'ya-json-schema-types';
import { type OpenAPI } from './index.js';
const myOpenAPI: OpenAPI<
ExpressiveJSONSchema,
{
'x-my-extension': ('plop' | 'plip')[];
}
> = {
openapi: '3.1',
info: {
'x-my-extension': 'plop',
title: 'Test',
version: '0.0.0',
},
paths: {},
};
The package also provides a few helpers to deal with OpenAPI/JSONSchemas references (only local file anchored references are supported).