Advise on managing non-production endpoints/paths (openapi-fetch) #1844
-
Hi, In our front-end team we're looking to start using openapi-typescript and openapi-fetch in a pretty big project, we have however identified a potential issue that we are unsure on how to resolve. Maybe we're missing something obvious. So looking for advise from the community. Back-end and front-end are located in separate repos and use different technologies. Questions arise when we start talking about feature/chore/bug branches. How does one sync proper types to a feature(or other) branch in front-end if back-end has made changes on a feature(or other) branch as well and we want to allow for pararell development in both teams? We excluded the idea of trying to dynamically find the correct back-end branch to sync the OpenAPI from due to overhead and optimistic nature of if, and we want to avoid having the dev specify manually. How has others/you done it? Keep in mind the PR needs to pass typecheck. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Great question. I actually built openapi-fetch while working on a system with backend and frontend in 2 different repos. Our solution wasn’t perfect, but we put the OpenAPI spec in a 3rd place. Now that seems on the surface like it just makes the problem worse, but it accomplishes several things:
The downsides are obvious—it’s more to manage, more friction, and I know devs want to just have “one and done” PRs for changes. But this is one of those things where introducing a little friction in the right ways could be helpful. Just an idea; obligatory YMMV and this may not work for every setup, and team. But is in an option that works well for some teams. Another option is polyglot monorepo but I wouldn’t recommend that at all 😅 (I’m a big fan of monolanguage monorepos but polyglot monorepos devolve pretty quickly). |
Beta Was this translation helpful? Give feedback.
Ah I should have figured the schemas were being autogenerated. Your idea makes a lot of sense! I think that’s a great balance of not disrupting the current dev flow you have, but while addressing the issues on the frontend.
Fortunately, too, simply copying a YAML file from one place to another is about the easiest automation you could do, so this seems like the way to go