OpenAPITools / OpenAPITools/openapi-generator
[BUG] createRequestFunction is broken when the response is a 403 forbidden error.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
We have working a complete implementation of OpenAPI from backend to frontend.
we have implemented Roles in the backend and if there an request made with not permission or (low permission like Read Only) the backend response wiht a 403 forbidden error.
in the front, when this response is received, the function createRequestFunction when is called in a generated coee, let's say update:
/**
*
* @param {string} entityId
* @param {VllCategoryBody} vllCategoryBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async update(entityId: string, vllCategoryBody: VllCategoryBody, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseOfVllCategoryResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.update(entityId, vllCategoryBody, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
the browser shows the error in the console:
but not error is thrown, so nothing can be handle and the app remains spinning forever.
openapi-generator version
v2.9.0
Suggest a fix
the function should throw any error to be handle in the customer side.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the generated TypeScript client's createRequestFunction, using the update method example and its 403 response as the reproduction path. Verify that the request promise settles with an error that callers can handle instead of remaining pending; the issue does not name a source file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100