diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
new file mode 100644
index 0000000..75d66bb
--- /dev/null
+++ b/.github/workflows/maven.yml
@@ -0,0 +1,25 @@
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: Java CI with Maven
+
+on:
+ push:
+ branches: [ dev ]
+ pull_request:
+ branches: [ dev ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: '11'
+ distribution: 'adopt'
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
diff --git a/pom.xml b/pom.xml
index 06616a8..6f2e42e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,11 +13,12 @@
11
${java.version}
${java.version}
- 2.9.10.7
+ 2.10.5
3.8.1
- 4.2
- 2.7
- 1.1.0
+ 4.4
+ 2.10.0
+ 1.9
+ 1.2.0
@@ -104,13 +105,18 @@
org.apache.commons
commons-collections4
- ${apache.commons-collections.version}
+ ${apache.commons-collections4.version}
commons-io
commons-io
${apache.commons-io.version}
+
+ org.apache.commons
+ commons-text
+ ${apache.commons-text.version}
+
com.fasterxml.jackson.core
jackson-databind
@@ -122,7 +128,7 @@
${jackson.version}
- com.overzealous
+ com.kotcrab.remark
remark
${remark.version}
diff --git a/src/main/java/com/microsoft/model/ExceptionItem.java b/src/main/java/com/microsoft/model/ExceptionItem.java
index b833f6b..4a21e41 100644
--- a/src/main/java/com/microsoft/model/ExceptionItem.java
+++ b/src/main/java/com/microsoft/model/ExceptionItem.java
@@ -1,5 +1,7 @@
package com.microsoft.model;
+import org.apache.commons.text.StringEscapeUtils;
+
public class ExceptionItem {
private final String type;
@@ -7,7 +9,7 @@ public class ExceptionItem {
public ExceptionItem(String type, String description) {
this.type = type;
- this.description = description;
+ this.description = StringEscapeUtils.unescapeJava(description);
}
public String getType() {
diff --git a/src/main/java/com/microsoft/model/MetadataFileItem.java b/src/main/java/com/microsoft/model/MetadataFileItem.java
index d953ea7..8def62d 100644
--- a/src/main/java/com/microsoft/model/MetadataFileItem.java
+++ b/src/main/java/com/microsoft/model/MetadataFileItem.java
@@ -9,6 +9,7 @@
import java.util.List;
import org.apache.commons.lang3.RegExUtils;
+import org.apache.commons.text.StringEscapeUtils;
@JsonPropertyOrder({"uid", "id", "parent", "children", "href", "langs", "isExternal", "name", "nameWithType",
"fullName", "overload", "overridden", "type", "package", "summary", "syntax", "inheritance", "implements", "exceptions",
@@ -158,7 +159,7 @@ public String getSummary() {
}
public void setSummary(String summary) {
- this.summary = summary;
+ this.summary = StringEscapeUtils.unescapeJava(summary);
}
public Syntax getSyntax() {
diff --git a/src/main/java/com/microsoft/model/MethodParameter.java b/src/main/java/com/microsoft/model/MethodParameter.java
index 2c6d5c0..8a63d56 100644
--- a/src/main/java/com/microsoft/model/MethodParameter.java
+++ b/src/main/java/com/microsoft/model/MethodParameter.java
@@ -1,5 +1,7 @@
package com.microsoft.model;
+import org.apache.commons.text.StringEscapeUtils;
+
public class MethodParameter {
private final String id;
@@ -25,6 +27,6 @@ public String getDescription() {
}
public void setDescription(String description) {
- this.description = description;
+ this.description = StringEscapeUtils.unescapeJava(description);
}
}
diff --git a/src/main/java/com/microsoft/model/Return.java b/src/main/java/com/microsoft/model/Return.java
index 712c282..e83a491 100644
--- a/src/main/java/com/microsoft/model/Return.java
+++ b/src/main/java/com/microsoft/model/Return.java
@@ -1,6 +1,7 @@
package com.microsoft.model;
import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.text.StringEscapeUtils;
public class Return {
@@ -27,6 +28,6 @@ public String getReturnDescription() {
}
public void setReturnDescription(String returnDescription) {
- this.returnDescription = returnDescription;
+ this.returnDescription = StringEscapeUtils.unescapeJava(returnDescription);
}
}
diff --git a/src/main/java/com/microsoft/model/SpecViewModel.java b/src/main/java/com/microsoft/model/SpecViewModel.java
index bb85c42..1597905 100644
--- a/src/main/java/com/microsoft/model/SpecViewModel.java
+++ b/src/main/java/com/microsoft/model/SpecViewModel.java
@@ -10,7 +10,6 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonPropertyOrder({"uid", "name", "fullName", "isExternal"})
-
public class SpecViewModel {
private String uid;
diff --git a/src/main/java/com/microsoft/util/FileUtil.java b/src/main/java/com/microsoft/util/FileUtil.java
index a11ea87..9953513 100644
--- a/src/main/java/com/microsoft/util/FileUtil.java
+++ b/src/main/java/com/microsoft/util/FileUtil.java
@@ -2,6 +2,7 @@
import com.microsoft.model.YmlFile;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -16,7 +17,7 @@ public static void dumpToFile(String content, String fileName) {
try {
Path path = Paths.get(fileName);
Files.createDirectories(path.getParent());
- Files.write(path, content.getBytes());
+ Files.write(path, content.getBytes(Charset.forName("UTF-8")));
} catch (IOException ioe) {
throw new RuntimeException("Error during dump to file", ioe);
}
diff --git a/src/test/java/com/microsoft/samples/noneascii/Offer.java b/src/test/java/com/microsoft/samples/noneascii/Offer.java
new file mode 100644
index 0000000..4dce77c
--- /dev/null
+++ b/src/test/java/com/microsoft/samples/noneascii/Offer.java
@@ -0,0 +1,38 @@
+package com.microsoft.samples.noneascii;
+
+/**
+ * 代表客户可用的产品形式
+ */
+public class Offer {
+ /**
+ * 初始化Offer类的新实例。
+ */
+ public Offer() {
+ }
+
+ /**
+ * 获取或设置合作伙伴要求的资格,以便为客户购买优惠。
+ */
+ private String[] __ResellerQualifications;
+
+ public String[] getResellerQualifications() {
+ return __ResellerQualifications;
+ }
+
+ public void setResellerQualifications(String[] value) {
+ __ResellerQualifications = value;
+ }
+
+ /**
+ * 获取或设置客户要求合作伙伴为客户购买的资格。
+ */
+ private String[] __ReselleeQualifications;
+
+ public String[] getReselleeQualifications() {
+ return __ReselleeQualifications;
+ }
+
+ public void setReselleeQualifications(String[] value) {
+ __ReselleeQualifications = value;
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.Offer.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.Offer.yml
new file mode 100644
index 0000000..f03ac81
--- /dev/null
+++ b/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.Offer.yml
@@ -0,0 +1,188 @@
+### YamlMime:ManagedReference
+items:
+- uid: "com.microsoft.samples.noneascii.Offer"
+ id: "Offer"
+ parent: "com.microsoft.samples.noneascii"
+ children:
+ - "com.microsoft.samples.noneascii.Offer.Offer()"
+ - "com.microsoft.samples.noneascii.Offer.getReselleeQualifications()"
+ - "com.microsoft.samples.noneascii.Offer.getResellerQualifications()"
+ - "com.microsoft.samples.noneascii.Offer.setReselleeQualifications(java.lang.String[])"
+ - "com.microsoft.samples.noneascii.Offer.setResellerQualifications(java.lang.String[])"
+ langs:
+ - "java"
+ name: "Offer"
+ nameWithType: "Offer"
+ fullName: "com.microsoft.samples.noneascii.Offer"
+ type: "Class"
+ package: "com.microsoft.samples.noneascii"
+ summary: "代表客户可用的产品形式"
+ syntax:
+ content: "public class Offer"
+ inheritance:
+ - "java.lang.Object"
+ inheritedMembers:
+ - "java.lang.Object.clone()"
+ - "java.lang.Object.equals(java.lang.Object)"
+ - "java.lang.Object.finalize()"
+ - "java.lang.Object.getClass()"
+ - "java.lang.Object.hashCode()"
+ - "java.lang.Object.notify()"
+ - "java.lang.Object.notifyAll()"
+ - "java.lang.Object.toString()"
+ - "java.lang.Object.wait()"
+ - "java.lang.Object.wait(long)"
+ - "java.lang.Object.wait(long,int)"
+- uid: "com.microsoft.samples.noneascii.Offer.Offer()"
+ id: "Offer()"
+ parent: "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "Offer()"
+ nameWithType: "Offer.Offer()"
+ fullName: "com.microsoft.samples.noneascii.Offer.Offer()"
+ overload: "com.microsoft.samples.noneascii.Offer.Offer*"
+ type: "Constructor"
+ package: "com.microsoft.samples.noneascii"
+ summary: "初始化Offer类的新实例。"
+ syntax:
+ content: "public Offer()"
+- uid: "com.microsoft.samples.noneascii.Offer.getReselleeQualifications()"
+ id: "getReselleeQualifications()"
+ parent: "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "getReselleeQualifications()"
+ nameWithType: "Offer.getReselleeQualifications()"
+ fullName: "com.microsoft.samples.noneascii.Offer.getReselleeQualifications()"
+ overload: "com.microsoft.samples.noneascii.Offer.getReselleeQualifications*"
+ type: "Method"
+ package: "com.microsoft.samples.noneascii"
+ syntax:
+ content: "public String[] getReselleeQualifications()"
+ return:
+ type: "java.lang.String[]"
+- uid: "com.microsoft.samples.noneascii.Offer.getResellerQualifications()"
+ id: "getResellerQualifications()"
+ parent: "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "getResellerQualifications()"
+ nameWithType: "Offer.getResellerQualifications()"
+ fullName: "com.microsoft.samples.noneascii.Offer.getResellerQualifications()"
+ overload: "com.microsoft.samples.noneascii.Offer.getResellerQualifications*"
+ type: "Method"
+ package: "com.microsoft.samples.noneascii"
+ syntax:
+ content: "public String[] getResellerQualifications()"
+ return:
+ type: "java.lang.String[]"
+- uid: "com.microsoft.samples.noneascii.Offer.setReselleeQualifications(java.lang.String[])"
+ id: "setReselleeQualifications(java.lang.String[])"
+ parent: "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "setReselleeQualifications(String[] value)"
+ nameWithType: "Offer.setReselleeQualifications(String[] value)"
+ fullName: "com.microsoft.samples.noneascii.Offer.setReselleeQualifications(String[] value)"
+ overload: "com.microsoft.samples.noneascii.Offer.setReselleeQualifications*"
+ type: "Method"
+ package: "com.microsoft.samples.noneascii"
+ syntax:
+ content: "public void setReselleeQualifications(String[] value)"
+ parameters:
+ - id: "value"
+ type: "java.lang.String[]"
+- uid: "com.microsoft.samples.noneascii.Offer.setResellerQualifications(java.lang.String[])"
+ id: "setResellerQualifications(java.lang.String[])"
+ parent: "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "setResellerQualifications(String[] value)"
+ nameWithType: "Offer.setResellerQualifications(String[] value)"
+ fullName: "com.microsoft.samples.noneascii.Offer.setResellerQualifications(String[] value)"
+ overload: "com.microsoft.samples.noneascii.Offer.setResellerQualifications*"
+ type: "Method"
+ package: "com.microsoft.samples.noneascii"
+ syntax:
+ content: "public void setResellerQualifications(String[] value)"
+ parameters:
+ - id: "value"
+ type: "java.lang.String[]"
+references:
+- uid: "com.microsoft.samples.noneascii.Offer.Offer*"
+ name: "Offer"
+ nameWithType: "Offer.Offer"
+ fullName: "com.microsoft.samples.noneascii.Offer.Offer"
+ package: "com.microsoft.samples.noneascii"
+- uid: "java.lang.String[]"
+ spec.java:
+ - uid: "java.lang.String"
+ name: "String"
+ fullName: "java.lang.String"
+ - name: "[]"
+ fullName: "[]"
+- uid: "com.microsoft.samples.noneascii.Offer.getResellerQualifications*"
+ name: "getResellerQualifications"
+ nameWithType: "Offer.getResellerQualifications"
+ fullName: "com.microsoft.samples.noneascii.Offer.getResellerQualifications"
+ package: "com.microsoft.samples.noneascii"
+- uid: "com.microsoft.samples.noneascii.Offer.setResellerQualifications*"
+ name: "setResellerQualifications"
+ nameWithType: "Offer.setResellerQualifications"
+ fullName: "com.microsoft.samples.noneascii.Offer.setResellerQualifications"
+ package: "com.microsoft.samples.noneascii"
+- uid: "com.microsoft.samples.noneascii.Offer.getReselleeQualifications*"
+ name: "getReselleeQualifications"
+ nameWithType: "Offer.getReselleeQualifications"
+ fullName: "com.microsoft.samples.noneascii.Offer.getReselleeQualifications"
+ package: "com.microsoft.samples.noneascii"
+- uid: "com.microsoft.samples.noneascii.Offer.setReselleeQualifications*"
+ name: "setReselleeQualifications"
+ nameWithType: "Offer.setReselleeQualifications"
+ fullName: "com.microsoft.samples.noneascii.Offer.setReselleeQualifications"
+ package: "com.microsoft.samples.noneascii"
+- uid: "java.lang.Object.notify()"
+ name: "Object.notify()"
+ nameWithType: "Object.notify()"
+ fullName: "java.lang.Object.notify()"
+- uid: "java.lang.Object.wait()"
+ name: "Object.wait()"
+ nameWithType: "Object.wait()"
+ fullName: "java.lang.Object.wait()"
+- uid: "java.lang.Object.finalize()"
+ name: "Object.finalize()"
+ nameWithType: "Object.finalize()"
+ fullName: "java.lang.Object.finalize()"
+- uid: "java.lang.Object.clone()"
+ name: "Object.clone()"
+ nameWithType: "Object.clone()"
+ fullName: "java.lang.Object.clone()"
+- uid: "java.lang.Object.notifyAll()"
+ name: "Object.notifyAll()"
+ nameWithType: "Object.notifyAll()"
+ fullName: "java.lang.Object.notifyAll()"
+- uid: "java.lang.Object.equals(java.lang.Object)"
+ name: "Object.equals(Object)"
+ nameWithType: "Object.equals(Object)"
+ fullName: "java.lang.Object.equals(java.lang.Object)"
+- uid: "java.lang.Object.getClass()"
+ name: "Object.getClass()"
+ nameWithType: "Object.getClass()"
+ fullName: "java.lang.Object.getClass()"
+- uid: "java.lang.Object.wait(long)"
+ name: "Object.wait(long)"
+ nameWithType: "Object.wait(long)"
+ fullName: "java.lang.Object.wait(long)"
+- uid: "java.lang.Object.hashCode()"
+ name: "Object.hashCode()"
+ nameWithType: "Object.hashCode()"
+ fullName: "java.lang.Object.hashCode()"
+- uid: "java.lang.Object.wait(long,int)"
+ name: "Object.wait(long,int)"
+ nameWithType: "Object.wait(long,int)"
+ fullName: "java.lang.Object.wait(long,int)"
+- uid: "java.lang.Object.toString()"
+ name: "Object.toString()"
+ nameWithType: "Object.toString()"
+ fullName: "java.lang.Object.toString()"
diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.yml
new file mode 100644
index 0000000..93b7156
--- /dev/null
+++ b/src/test/resources/expected-generated-files/com.microsoft.samples.noneascii.yml
@@ -0,0 +1,19 @@
+### YamlMime:ManagedReference
+items:
+- uid: "com.microsoft.samples.noneascii"
+ id: "noneascii"
+ children:
+ - "com.microsoft.samples.noneascii.Offer"
+ langs:
+ - "java"
+ name: "com.microsoft.samples.noneascii"
+ nameWithType: "com.microsoft.samples.noneascii"
+ fullName: "com.microsoft.samples.noneascii"
+ type: "Namespace"
+ syntax:
+ content: "package com.microsoft.samples.noneascii"
+references:
+- uid: "com.microsoft.samples.noneascii.Offer"
+ name: "Offer"
+ nameWithType: "Offer"
+ fullName: "com.microsoft.samples.noneascii.Offer"
diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.yml
index 63175cd..b8e64fe 100644
--- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.yml
+++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.yml
@@ -21,7 +21,7 @@ items:
fullName: "com.microsoft.samples.subpackage.Person"
type: "Class"
package: "com.microsoft.samples.subpackage"
- summary: "Class that describes some person This comment has links to:\n\n * Owner class Person\n * Its inner class Person.IdentificationInfo\n * Its method Person#setLastName(String lastName)\n * Its method without params Person#setLastName()\n * Its public field Person#age\n * Another class which used here Set\n * Another class which not used here List\n * Broken link sdfdsagdsfghfgh\n * Plain link someContent\n * Link that starts from '\\#' #setLastName()\n * Link with label WordOne\n\nThis is an \"at\" symbol: @"
+ summary: "Class that describes some person This comment has links to:\n\n * Owner class Person\n * Its inner class Person.IdentificationInfo\n * Its method Person#setLastName(String lastName)\n * Its method without params Person#setLastName()\n * Its public field Person#age\n * Another class which used here Set\n * Another class which not used here List\n * Broken link sdfdsagdsfghfgh\n * Plain link someContent\n * Link that starts from '#' #setLastName()\n * Link with label WordOne\n\nThis is an \"at\" symbol: @"
syntax:
content: "public class Person"
typeParameters:
diff --git a/src/test/resources/expected-generated-files/toc.yml b/src/test/resources/expected-generated-files/toc.yml
index a4e2eff..4239bc1 100644
--- a/src/test/resources/expected-generated-files/toc.yml
+++ b/src/test/resources/expected-generated-files/toc.yml
@@ -31,6 +31,11 @@
name: "Organism"
- uid: "com.microsoft.samples.commentinheritance.Viviparous"
name: "Viviparous"
+- uid: "com.microsoft.samples.noneascii"
+ name: "com.microsoft.samples.noneascii"
+ items:
+ - uid: "com.microsoft.samples.noneascii.Offer"
+ name: "Offer"
- uid: "com.microsoft.samples.offers"
name: "com.microsoft.samples.offers"
items: