Skip to content

Commit c3bd311

Browse files
committed
hack: make multiple integration tests generate
1 parent a3d20ab commit c3bd311

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
@@ -26,7 +26,7 @@ export class OpenapiLoader {
2626
private readonly library = new Map<string, OpenapiDocument>()
2727

2828
private constructor(
29-
private readonly entryPointKey: string,
29+
public readonly entryPointKey: string,
3030
private readonly config: {titleOverride: string | undefined},
3131
private readonly validator: OpenapiValidator,
3232
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
@@ -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)