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

Provide name in transform

Open Nvveen opened this issue 2 years ago • 1 comments

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

Nvveen avatar Mar 15 '23 18:03 Nvveen

@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.

radist2s avatar Feb 04 '24 12:02 radist2s

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 15 '24 02:08 github-actions[bot]