Skip to content

Commit bfbbaf4

Browse files
committed
hack: make multiple integration tests generate
1 parent 344546b commit bfbbaf4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

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

2626
private constructor(
27-
private readonly entryPointKey: string,
27+
public readonly entryPointKey: string,
2828
private readonly validator: OpenapiValidator,
2929
private readonly genericLoader: GenericLoader,
3030
) {

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
@@ -423,8 +423,14 @@ export async function generateTypescriptNextJS(
423423
): Promise<void> {
424424
const input = config.input
425425

426-
const appDirectory = "./app/api"
427-
const routesDirectory = "./generated/api"
426+
const subDirectory = process.env["OPENAPI_INTEGRATION_TESTS"]
427+
? path.basename(config.input.loader.entryPointKey)
428+
: ""
429+
430+
const appDirectory = ["./app", subDirectory].filter(isDefined).join(path.sep)
431+
const routesDirectory = ["./generated", subDirectory]
432+
.filter(isDefined)
433+
.join(path.sep)
428434

429435
const rootTypeBuilder = await TypeBuilder.fromInput(
430436
"./generated/api/models.ts",

0 commit comments

Comments
 (0)