diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 85ac755a42c6..208d42834eb7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -17,11 +17,14 @@ package org.openapitools.codegen.languages; +import com.google.common.collect.ImmutableMap; +import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.utils.ModelUtils; import java.io.File; @@ -134,6 +137,14 @@ public void processOpts() { } } + @Override + protected ImmutableMap.Builder addMustacheLambdas() { + ImmutableMap.Builder lambdas = super.addMustacheLambdas(); + lambdas.put("indented_star_1", new IndentedLambda(1, " ", "* ")); + lambdas.put("indented_star_4", new IndentedLambda(5, " ", "* ")); + return lambdas; + } + @Override public String getTypeDeclaration(Schema p) { if (ModelUtils.isFileSchema(p)) { diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 39ed958da288..32f0a1c54bb5 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -28,8 +28,8 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn {{#withInterfaces}} {{#operations}} /** - * {{classname}} - interface{{#description}} - * {{&description}}{{/description}} + * {{classname}} - interface + * {{#lambda.indented_1}}{{{unescapedDescription}}}{{/lambda.indented_1}} * @export * @interface {{classname}}Interface */ @@ -71,7 +71,7 @@ export interface {{classname}}Interface { {{/withInterfaces}} {{#operations}} /** - * {{#description}}{{{description}}}{{/description}}{{^description}}no description{{/description}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} */ {{#withInterfaces}} export class {{classname}} extends runtime.BaseAPI implements {{classname}}Interface { diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache index b08c8f24dc1a..7534f9b391a1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache @@ -1,5 +1,5 @@ /** - * {{{description}}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export * @enum {string} */ diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index ca1837946ea7..bd593da18308 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -19,7 +19,7 @@ import { {{/discriminator}} /** - * {{{description}}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export * @interface {{classname}} */ @@ -29,7 +29,7 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{/additionalPropertiesType}} {{#vars}} /** - * {{{description}}} + * {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}} * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> * @memberof {{classname}} */ diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache index 2c957dbd2040..506d8207bc97 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -11,8 +11,8 @@ import { {{/hasImports}} /** - * @type {{classname}}{{#description}} - * {{{description}}}{{/description}} + * @type {{classname}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export */ export type {{classname}} = {{#discriminator}}{{#mappedModels}}{ {{discriminator.propertyName}}: '{{mappingName}}' } & {{modelName}}{{^-last}} | {{/-last}}{{/mappedModels}}{{/discriminator}}{{^discriminator}}{{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}}{{/discriminator}}; diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index 7be9cd13bfd8..6975933a9658 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts index 9d094207bb78..c8f7ac7c5368 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index 36150d523bc5..e64925bda21a 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 17731c8760e2..e8d463f39e26 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface PetApiUploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index 7f38fd436aea..805aa3365009 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface StoreApiPlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 1d97220cb00f..3fd0e8e13704 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UserApiUpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index 3aaa0da493a2..95a3c8d2ee57 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -62,6 +62,7 @@ export interface UploadFileRequest { /** * PetApi - interface + * * @export * @interface PetApiInterface */ @@ -197,7 +198,7 @@ export interface PetApiInterface { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI implements PetApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts index 5c379a79098c..cd2e4e760330 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts @@ -34,6 +34,7 @@ export interface PlaceOrderRequest { /** * StoreApi - interface + * * @export * @interface StoreApiInterface */ @@ -103,7 +104,7 @@ export interface StoreApiInterface { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts index 43bb1ebc0324..257dde3bfe08 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts @@ -52,6 +52,7 @@ export interface UpdateUserRequest { /** * UserApi - interface + * * @export * @interface UserApiInterface */ @@ -183,7 +184,7 @@ export interface UserApiInterface { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI implements UserApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI {