Skip to content

How to dynamically assign schema to openapi-fetch request? #1978

Answered by drwpow-figma
licongy asked this question in Q&A
Discussion options

You must be logged in to vote

This is probably a hiccup with any typed client, not just openapi-fetch, because it sounds like you might need different types for the client vs the server (or the proxy; whichever layer differs I’m not entirely sure). If that’s the case, the simplest recommendation is if the shapes are different, then those are 2 different OpenAPI shapes. Perhaps they don’t have to be separate schemas, but even if they reuse the same methods+statuses but handle different shapes, you can always split your OpenAPI schema into 3 documents: client paths, server paths, and shared components. That way you can reuse most of the same schema but just describe the ways in which they may depart.

If your OpenAPI sch…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by licongy
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