openapi-typescript-code-generator icon indicating copy to clipboard operation
openapi-typescript-code-generator copied to clipboard

Bug: complex remote reference is broken

Open karupanerura opened this issue 2 years ago • 1 comments

Steps To Reproduce

Apply this patch: https://github.com/Himenon/openapi-typescript-code-generator/compare/%40himenon/openapi-typescript-code-generator%400.19.1...karupanerura:openapi-typescript-code-generator:test/add-broken-case

pnpm build
pnpm run test:code:gen

The current behavior

Generate Code : test/code/typedef-with-template/ref-access.ts

/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:99
  const findSchemaByPathArray = (
                                ^
RangeError: Maximum call stack size exceeded
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:99:33)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)
    at findSchemaByPathArray (/Users/kenta.sato/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/TypeNodeContext.ts:105:14)

The expected behavior

Accept this reference.

karupanerura avatar Nov 09 '22 12:11 karupanerura

Thanks for the bug report. It's going to take me a while longer to get this fixed as I haven't had a lot of time lately.

@karupanerura

Himenon avatar Nov 15 '22 06:11 Himenon