How to combine schemas in a monolithic monorepo? #4901
Unanswered
florence-wolfe
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a monolithic monorepo with many modules split up by directory. These aren't true separate packages as they're all part of 1 monolith.
I've noticed that if I try to create a root TypeSpec configuration for my entire API in a directory such as
/tools/typespec/
and aim to have individual schemas in my modules such as/apps/module_a/schema
,/apps/module_b/schema
, etc. that I end up with compiler errors.Here's how I wrote my
main.tsp
file in my root typespec schema, for example:Here's my
api.tsp
in that same directory:Meanwhile, in the module schemas I don't add a tspconfig.yaml, nor package.json as I would expect them to inherit the imports at compile time. Instead, I'm met with errors such as
error import-not-found: Couldn't resolve import "@typespec/rest"
for each of the files in my modules that are imported by the root.Is there any way to achieve this for composition purposes? I'd like to avoid requiring everyone to need to write their schemas in the root typespec directory and would prefer to have them scoped to their respective modules.
Beta Was this translation helpful? Give feedback.
All reactions