openapi-typescript
openapi-typescript copied to clipboard
Metadata generation
Description Currently, objects such as the Info Object and Server Object get ignored. I've written a set of PoC transformers that allows them to be generated into exported declarations like so.
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export const info = {
title: "Test API Documentation",
version: "1.12.1",
contact: {
name: "Test contact username",
url: "https://...",
email: "[email protected]"
},
license: {
url: "https://...",
name: "MIT"
},
description: "Test description"
};
export type paths = Record<string, never>;
export type webhooks = Record<string, never>;
export interface components {
schemas: never;
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
export type $defs = Record<string, never>;
export type operations = Record<string, never>;
The use-case being to (optionally) restrict baseUrl for openapi-fetch to the declared servers or other such cases where metadata is required; specification version mismatching, contact support,...
Proposal If the maintainer(s) think this is a valuable addition, I'd gladly help implementing it in the official library.
Checklist
- [x] I’m willing to open a PR for this (see CONTRIBUTING.md)