Skip to content

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

Open
@pushred

Description

@pushred

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions