Bug Report Checklist
Description
When generating typescript-angular api's from a spec that uses externe type mappings inside a response body, the generator is stuck in an infinite loop when trying to 'unalias' the schema for the external type.
Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern.error(Pattern.java:1969) at java.util.regex.Pattern.<init>(Pattern.java:1354) at java.util.regex.Pattern.compile(Pattern.java:1054) at java.lang.String.replace(String.java:2239) at org.openapitools.codegen.utils.ModelUtils.getSimpleRef(ModelUtils.java:406) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1208) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256)
openapi-generator version
6.0.1
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: OpenAPI definition
version: v0
paths:
"/api/external-resources":
get:
operationId: getExternalResources
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
"$ref": "#/components/schemas/ExternalResource"
components:
schemas:
ExternalResource:
"$ref": "#/components/schemas/ExternalResource"
Generation Details
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.0.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>openapi.yaml</inputSpec>
<generatorName>typescript-angular</generatorName>
<schemaMappings>ExternalResource</schemaMappings>
<importMappings>ExternalResource=@external/resource</importMappings>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Generate typescript based on above spec and provided maven plugin configuration.
Related issues/PRs
Suggest a fix
Passing the schemaMapping in AbstractTypeScriptClientCodegen to the unaliasSchema method on lines 433 and 437 fixes the issue.
ModelUtils.unaliasSchema(this.openAPI, items, schemaMapping)
Bug Report Checklist
Description
When generating typescript-angular api's from a spec that uses externe type mappings inside a response body, the generator is stuck in an infinite loop when trying to 'unalias' the schema for the external type.
Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern.error(Pattern.java:1969) at java.util.regex.Pattern.<init>(Pattern.java:1354) at java.util.regex.Pattern.compile(Pattern.java:1054) at java.lang.String.replace(String.java:2239) at org.openapitools.codegen.utils.ModelUtils.getSimpleRef(ModelUtils.java:406) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1208) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256) at org.openapitools.codegen.utils.ModelUtils.unaliasSchema(ModelUtils.java:1256)openapi-generator version
6.0.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Generate typescript based on above spec and provided maven plugin configuration.
Related issues/PRs
Suggest a fix
Passing the schemaMapping in
AbstractTypeScriptClientCodegento theunaliasSchemamethod on lines 433 and 437 fixes the issue.ModelUtils.unaliasSchema(this.openAPI, items, schemaMapping)