From 68f63ba961d3ba14a69e99fe705528b573c9f946 Mon Sep 17 00:00:00 2001 From: Ann Meng Date: Mon, 19 Oct 2020 13:25:15 +0800 Subject: [PATCH] handle "filed" uid in MemberModel.java to avoid duplicate uid exception in docfx --- .../java/com/microsoft/model/sdp/file/MemberModel.java | 8 +++++++- ...com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING.yml | 2 +- ...osoft.samples.subpackage.HttpStatusCode.BADREQUEST.yml | 2 +- ...crosoft.samples.subpackage.HttpStatusCode.CONFLICT.yml | 2 +- ...amples.subpackage.HttpStatusCode.EXPECTATIONFAILED.yml | 2 +- ...rosoft.samples.subpackage.HttpStatusCode.FORBIDDEN.yml | 2 +- ...crosoft.samples.subpackage.HttpStatusCode.NOTFOUND.yml | 2 +- ...mples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE.yml | 2 +- ...oft.samples.subpackage.HttpStatusCode.UNAUTHORIZED.yml | 2 +- .../com.microsoft.samples.subpackage.Person.age.yml | 2 +- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/microsoft/model/sdp/file/MemberModel.java b/src/main/java/com/microsoft/model/sdp/file/MemberModel.java index 3d06355..fbd816a 100644 --- a/src/main/java/com/microsoft/model/sdp/file/MemberModel.java +++ b/src/main/java/com/microsoft/model/sdp/file/MemberModel.java @@ -45,8 +45,14 @@ public MemberModel(String uid, MetadataFileItem item, String outputPath) { } + + /** + * This method is used to build model for "filed". + * In order to avoid duplicate uid in docfx and align with method/constructor, + * add '*' to the end of uid for root level as well. + */ public MemberModel(MetadataFileItem item, String outputPath) { - super(item.getUid(), item.getName()); + super(String.format("%s%s", item.getUid(), '*'), item.getName()); this.outputPath = outputPath; this.setFullName(item.getFullName()); this.setNameWithType(item.getNameWithType()); diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING.yml index 37effef..205d037 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING" +uid: "com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING*" fullName: "com.microsoft.samples.SuperHero.SOME_PUBLIC_STRING" name: "SOME_PUBLIC_STRING" nameWithType: "SuperHero.SOME_PUBLIC_STRING" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST.yml index 2bc33a2..e9714b3 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.BADREQUEST" name: "BADREQUEST" nameWithType: "HttpStatusCode.BADREQUEST" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT.yml index 4d3908b..f18d28d 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.CONFLICT" name: "CONFLICT" nameWithType: "HttpStatusCode.CONFLICT" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED.yml index 48e36ed..16e8446 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.EXPECTATIONFAILED" name: "EXPECTATIONFAILED" nameWithType: "HttpStatusCode.EXPECTATIONFAILED" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN.yml index b70a6e7..aec4647 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.FORBIDDEN" name: "FORBIDDEN" nameWithType: "HttpStatusCode.FORBIDDEN" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND.yml index 973480c..f171e9b 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.NOTFOUND" name: "NOTFOUND" nameWithType: "HttpStatusCode.NOTFOUND" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE.yml index 04a80e5..e8ff9aa 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.SERVICEUNAVAILABLE" name: "SERVICEUNAVAILABLE" nameWithType: "HttpStatusCode.SERVICEUNAVAILABLE" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED.yml index c8c9294..2c98c58 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED" +uid: "com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED*" fullName: "com.microsoft.samples.subpackage.HttpStatusCode.UNAUTHORIZED" name: "UNAUTHORIZED" nameWithType: "HttpStatusCode.UNAUTHORIZED" diff --git a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.age.yml b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.age.yml index a343768..e080487 100644 --- a/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.age.yml +++ b/src/test/resources/expected-generated-files/com.microsoft.samples.subpackage.Person.age.yml @@ -1,5 +1,5 @@ ### YamlMime:JavaMember -uid: "com.microsoft.samples.subpackage.Person.age" +uid: "com.microsoft.samples.subpackage.Person.age*" fullName: "com.microsoft.samples.subpackage.Person.age" name: "age" nameWithType: "Person.age"