Skip to content

New typings no longer allow partial extractingOptions on generateApi config #1183

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

Open
pushred opened this issue Apr 21, 2025 · 0 comments
Open

Comments

@pushred
Copy link

pushred commented Apr 21, 2025

Image

I suspect this change was not intentional so reporting it.. I was previously on v13.0.23 and in the typings changes since the programmatic generateApi function's typings no longer allow partial extractingOptions config to be provided.

This is still typed as Partial<ExtractingOptions> on CodeGenConfig here where defaults are defined:

extractingOptions: Partial<ExtractingOptions> = {
requestBodySuffix: ["Payload", "Body", "Input"],
requestParamsSuffix: ["Params"],
responseBodySuffix: ["Data", "Result", "Output"],
responseErrorSuffix: [
"Error",
"Fail",
"Fails",
"ErrorData",
"HttpError",
"BadResponse",
],
enumSuffix: ["Enum"],
discriminatorMappingSuffix: ["Mapping", "Mapper", "MapType"],
discriminatorAbstractPrefix: [
"Base",
"Abstract",
"Discriminator",
"Internal",
"Polymorph",
],
};

But it looks like that is overridden by the parameter type here:

config: Partial<GenerateApiConfiguration["config"]>,

/** extra configuration for extracting type names operations */
extractingOptions?: ExtractingOptions;

In the earlier version index.d.ts typed this prop as CodeGenConfig still does:

/** extra configuration for extracting type names operations */
extractingOptions?: Partial<ExtractingOptions>;

My workaround for now casting to any

@pushred pushred changed the title New typings no longer allow partial extractingOptions on GenerateApiConfiguration New typings no longer allow partial extractingOptions on generateApi config Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant