diff --git a/core/che-core-typescript-dto-maven-plugin/pom.xml b/core/che-core-typescript-dto-maven-plugin/pom.xml index a2b076fc6b9..02ff9d6ec08 100644 --- a/core/che-core-typescript-dto-maven-plugin/pom.xml +++ b/core/che-core-typescript-dto-maven-plugin/pom.xml @@ -204,6 +204,7 @@ test + 0 ${project.build.directory} diff --git a/core/che-core-typescript-dto-maven-plugin/src/it/resources/dto.spec.ts b/core/che-core-typescript-dto-maven-plugin/src/it/resources/dto.spec.ts index 6d7fd803e5c..29164185a04 100644 --- a/core/che-core-typescript-dto-maven-plugin/src/it/resources/dto.spec.ts +++ b/core/che-core-typescript-dto-maven-plugin/src/it/resources/dto.spec.ts @@ -121,6 +121,10 @@ describe("DTO serialization tests", () => { expect(customDto.customMap["bar"].name).to.eql("foo"); }); + it("check Serializable type", () => { + const customDto: che.plugin.typescript.MyDtoWithSerializable = { + }; + }); }); diff --git a/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java b/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java index 175aa7ab42b..28c01d6254a 100644 --- a/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java +++ b/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.plugin.typescript.dto; +import java.io.Serializable; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -139,6 +140,8 @@ public static String convertType(Type type) { return "number"; } else if (Boolean.class.equals(type) || Boolean.TYPE.equals(type)) { return "boolean"; + } else if (Serializable.class.equals(type)) { + return "string | number | boolean"; } return type.getTypeName(); @@ -210,6 +213,8 @@ public static String convertTypeForDTS(Type containerType, Type type) { return "number"; } else if (Boolean.class.equals(type) || Boolean.TYPE.equals(type)) { return "boolean"; + } else if (Serializable.class.equals(type)) { + return "string | number | boolean"; } String declarationPackage = convertToDTSPackageName((Class) containerType); diff --git a/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyDtoWithSerializableDTO.java b/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyDtoWithSerializableDTO.java new file mode 100644 index 00000000000..c91055cfc32 --- /dev/null +++ b/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyDtoWithSerializableDTO.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2012-2018 Red Hat, Inc. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + */ +package org.eclipse.che.plugin.typescript.dto; + +import java.io.Serializable; +import java.util.Map; +import org.eclipse.che.dto.shared.DTO; + +@DTO +public interface MyDtoWithSerializableDTO { + Map getPreferences(); + + void setPreferences(Map preferences); +} diff --git a/typescript-dto/build.sh b/typescript-dto/build.sh index 2c33cda62d4..a53c24c0d87 100755 --- a/typescript-dto/build.sh +++ b/typescript-dto/build.sh @@ -12,6 +12,8 @@ set -e set -u +rm -f ./index.d.ts + docker run -i --rm -v "$HOME/.m2:/root/.m2" \ -v "$(pwd)/dto-pom.xml:/usr/src/mymaven/pom.xml" \ -w /usr/src/mymaven maven:3.3-jdk-8 \ diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/CommandDto.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/CommandDto.java index b840a06e29f..c1f6d246da3 100644 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/CommandDto.java +++ b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/dto/CommandDto.java @@ -17,6 +17,7 @@ import java.util.Map; import org.eclipse.che.api.core.factory.FactoryParameter; import org.eclipse.che.api.core.model.workspace.config.Command; +import org.eclipse.che.api.workspace.shared.dto.devfile.PreviewUrlDto; import org.eclipse.che.dto.shared.DTO; /** @author Alexander Garagatyi */ @@ -54,4 +55,11 @@ public interface CommandDto extends Command { void setAttributes(Map attributes); CommandDto withAttributes(Map attributes); + + @Override + PreviewUrlDto getPreviewUrl(); + + void setPreviewUrl(PreviewUrlDto previewUrl); + + CommandDto withPreviewUrl(PreviewUrlDto previewUrl); }