openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

Copy the API version to output file

Open jsphstls opened this issue 1 year ago • 1 comments

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

  • [X] I’m willing to open a PR for this.

jsphstls avatar Feb 20 '24 19:02 jsphstls

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.

drwpow avatar Feb 23 '24 00:02 drwpow

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Aug 06 '24 12:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Aug 14 '24 02:08 github-actions[bot]