Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata generation #1630

Open
1 task done
bddvlpr opened this issue Apr 24, 2024 · 0 comments
Open
1 task done

Metadata generation #1630

bddvlpr opened this issue Apr 24, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed openapi-ts Relevant to the openapi-typescript library

Comments

@bddvlpr
Copy link
Sponsor

bddvlpr commented Apr 24, 2024

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: "un@known.com"
    },
    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

@bddvlpr bddvlpr added enhancement New feature or request help wanted Extra attention is needed openapi-ts Relevant to the openapi-typescript library labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

1 participant