Skip to content
Discussion options

You must be logged in to vote

I think the cleanest solution is to model this in the OpenAPI responses if you can.

Orval's React Query + axios error type is derived from the non-2xx responses in the spec. In the current code path, the generated query error type becomes AxiosError<...> where ... is the deduped union of documented error responses. If there are no documented error responses, it falls back to unknown.

So for an expected-but-not-operation-specific failure shape, add a shared default response, or explicit 500 / 5XX responses, for example:

responses:
  '200':
    description: OK
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/MySuccess'
  default:
    description: Un…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by melloware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants