Skip to content

Commit 4c41bcc

Browse files
committed
hack: make multiple integration tests generate
1 parent 311e32d commit 4c41bcc

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/openapi-code-generator/src/core/openapi-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class OpenapiLoader {
2828
private readonly library = new Map<string, OpenapiDocument>()
2929

3030
private constructor(
31-
private readonly entryPointKey: string,
31+
public readonly entryPointKey: string,
3232
private readonly config: {titleOverride: string | undefined},
3333
private readonly validator: OpenapiValidator,
3434
private readonly genericLoader: GenericLoader,

packages/openapi-code-generator/src/typescript/typescript-nextjs/typescript-nextjs.generator.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,14 @@ export async function generateTypescriptNextJS(
428428
): Promise<void> {
429429
const input = config.input
430430

431-
const appDirectory = "./app/api"
432-
const routesDirectory = "./generated/api"
431+
const subDirectory = process.env["OPENAPI_INTEGRATION_TESTS"]
432+
? path.basename(config.input.loader.entryPointKey)
433+
: ""
434+
435+
const appDirectory = ["./app", subDirectory].filter(isDefined).join(path.sep)
436+
const routesDirectory = ["./generated", subDirectory]
437+
.filter(isDefined)
438+
.join(path.sep)
433439

434440
const rootTypeBuilder = await TypeBuilder.fromInput(
435441
"./generated/api/models.ts",

0 commit comments

Comments
 (0)