OpenAPITools / OpenAPITools/openapi-generator

[Question] How to capture 403 response from generated APIClient (java/webclient)

Open
#12,809 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Announcement
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I generated a client using generatorName java and library webclient. The generate api client works the service side REST api returns success. But when I get a HTTP 403 response, the block() call just hangs.

Code is like this:

ReportsApi reportApi = new ReportsApi();
Mono rsp = reportApi.reportsGetDatasourcesInGroup(UUID.fromString(workspaceId), UUID.fromString(reportId));
Datasources ds= rsp.block();

I attempt to add .onErrorMap() and other on the Mono object, with no luck.

I know why I am getting 403 from the server, but I just need to be able to capture it in code so I can do the appropriate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Java webclient ReportsApi call and its Mono.block() usage. Reproduce the HTTP 403 response and inspect how the generated client represents that response and propagates errors. Done means the caller can capture the 403 in code and handle it appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.