fix: Change RepoModule into a union with oneOf
This commit is contained in:
parent
cd2ecc5f95
commit
8b44a588a4
2 changed files with 13 additions and 6 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
tsp-output/*
|
tsp-output/
|
||||||
node_modules/*
|
node_modules/
|
||||||
dist/*
|
dist/
|
||||||
src-tsp/modules/*
|
src-tsp/modules/
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,12 @@ for (const module of modules) {
|
||||||
|
|
||||||
fs.writeFileSync(`${modulesDir}/index.tsp`,
|
fs.writeFileSync(`${modulesDir}/index.tsp`,
|
||||||
moduleImports.map(m => `import "./${m}";`).join("\n") + `
|
moduleImports.map(m => `import "./${m}";`).join("\n") + `
|
||||||
alias RepoModule = ${moduleModels.map(m => `${m}Module`).join(" | ")};`
|
import "@typespec/json-schema";
|
||||||
)
|
|
||||||
|
using TypeSpec.JsonSchema;
|
||||||
|
|
||||||
|
@oneOf
|
||||||
|
union RepoModule {
|
||||||
|
${moduleModels.map(m => ` ${m}Module`).join(",\n")}
|
||||||
|
}`
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue