add schema mapping support in typescript client codegen (#12840)

This commit is contained in:
William Cheng 2022-07-12 13:40:33 +08:00 committed by GitHub
parent 4bbfa01ba8
commit 00db9255c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -885,10 +885,10 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
Schema inner;
if (ModelUtils.isArraySchema(p)) {
inner = ((ArraySchema) p).getItems();
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + ">";
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner, schemaMapping)) + ">";
} else if (ModelUtils.isMapSchema(p)) {
inner = (Schema) p.getAdditionalProperties();
return "{ [key: string]: " + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + "; }";
return "{ [key: string]: " + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner, schemaMapping)) + "; }";
} else if (ModelUtils.isFileSchema(p)) {
return "HttpFile";
} else if (ModelUtils.isBinarySchema(p)) {