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

Copy the API version to output file #1557

Open
1 task done
jsphstls opened this issue Feb 20, 2024 · 1 comment
Open
1 task done

Copy the API version to output file #1557

jsphstls opened this issue Feb 20, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed openapi-ts Relevant to the openapi-typescript library

Comments

@jsphstls
Copy link

jsphstls commented Feb 20, 2024

Description

I want to know which version of the API was used as the source for the generated TypeScript. The API that I am working with requires that the API version be sent in each request.

Proposal

Include enough of the API General Info to indicate the API version in the output file:

export type info = {      
    version: '1.0.0';
}

I can then surface a compilation error if I happen to be mistaken about which version of the API was used as the source of the output file:

const version: info['version'] = '1.0.0';

Checklist

  • I’m willing to open a PR for this.
@jsphstls jsphstls added enhancement New feature or request help wanted Extra attention is needed openapi-ts Relevant to the openapi-typescript library labels Feb 20, 2024
@drwpow
Copy link
Owner

drwpow commented Feb 23, 2024

Works for me! No harm in adding this. Would love a PR

Be sure to base off the 6.x branch so it can be added to the stable v, then we’ll just port it to 7.x. Since this is a backwards-compatible addition, no reason not to ship it in stable now.

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

2 participants