openapi-ts / openapi-typescript

Generate TypeScript types from OpenAPI 3 specs
https://openapi-ts.dev
MIT License
5.47k stars 449 forks source link

Provide name in transform #1054

Closed Nvveen closed 3 weeks ago

Nvveen commented 1 year ago

Description

I want to use the transform function to extract common enums from our API spec into separate type declarations (and even transform them into const arrays), by filtering by name. Currently this is not possible, because the transform function only provides the SchemaObject and Context as a parameter.

Proposal

Provide the name or key parameter as a third parameter to the transform function.

Checklist

radist2s commented 7 months ago

@drwpow, I too have encountered the need to know the name of a schemaObject, and also need access to the parent schemaObject. This is necessary to be able to check required properties and to return the questionToken correctly. What do you think about if we expand the number of accepted arguments for options.ctx.transform()? I could prepare a PR along with a corresponding documentation update.

github-actions[bot] commented 1 month ago

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] commented 3 weeks ago

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.