Skip to content

[BUG][TypeScript Angular] delete operation is broken #11172

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
whydoievenneedthis opened this issue Dec 21, 2021 · 2 comments
Open

[BUG][TypeScript Angular] delete operation is broken #11172

whydoievenneedthis opened this issue Dec 21, 2021 · 2 comments

Comments

@whydoievenneedthis
Copy link

Description

The delete operations are broken. POST, PATCH and PUT supports a body as the second parameter of the call, with the options being at the third position. DELETE, however, requires the body to be put into the second option parameter.

See also:
https://angular.io/api/common/http/HttpClient

openapi-generator version

5.3.1

Generated typescript code
        return this.httpClient.delete<any>(`${this.configuration.basePath}/thingy`,
          null,
            {
                context: localVarHttpContext,
                responseType: <any>responseType_,
                withCredentials: this.configuration.withCredentials,
                headers: localVarHeaders,
                observe: observe,
                reportProgress: reportProgress
            }
        );
Expected typescript code
        return this.httpClient.delete<any>(`${this.configuration.basePath}/thingy`,
            {
                context: localVarHttpContext,
                responseType: <any>responseType_,
                withCredentials: this.configuration.withCredentials,
                headers: localVarHeaders,
                observe: observe,
                reportProgress: reportProgress,
                body: null
            }
        );
@PeterOeClausen
Copy link

Same as: #10864

@sverbach-zuehlke
Copy link

sverbach-zuehlke commented Feb 1, 2024

Ran into the same issues. Out of the blue I couldn't generate code for DELETE endpoints anymore. Updating to the latest @openapitools/openapi-generator-cli also did not help.

Solved it by setting the 'ngVersion' additional-property to '12.0.0' (although the project is on v14) in the command:

openapi-generator-cli generate -i http://localhost:XXXX/.../swagger.json -g typescript-angular -o src/generated/api --additional-properties=withInterfaces=true --additional-properties=ngVersion=12.0.0

setting it to any major version above "12.0.0" will break the code generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants