diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java deleted file mode 100644 index f3f6df416fb3311d576ce3bf726ce58bdc22e9b4..0000000000000000000000000000000000000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Header.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Setter -@Getter -@NoArgsConstructor -public class Header{ - - public static final Header APPLICATION_JSON = new Header("Content-Type","application/json"); - public static final Header X_FORM_WWW_URLENCODED = new Header("Content-Type","x-www-form-urlencoded"); - - String key; - String value; - String description; - - public Header(String key, String value) { - this.key = key; - this.value = value; - } - - public static Header valueOf(String text){ - String[] arr = text.split(":"); - Header header = new Header(); - header.setKey(arr[0]); - if(arr.length>1){ - header.setValue(arr[1]); - } - return header; - } - - @Override - public String toString(){ - return key + ": " + value; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java deleted file mode 100644 index a4f32260076004e020b6dab04ea3f6614326e263..0000000000000000000000000000000000000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Method.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.extern.slf4j.Slf4j; - -/** - * 支持的http method - */ -@Slf4j -public enum Method { - - - GET,POST,PUT,DELETE, - OPTIONS,PATCH,COPY,HEAD,LINK,UNLINK,PURGE,LOCK,UNLOCK,PROPFIND,VIEW; - - public static Method of(String name) { - return valueOf(name); - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java deleted file mode 100644 index d4fc4048709172640731201ee6d23a915d5a12da..0000000000000000000000000000000000000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Row.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.*; - -@EqualsAndHashCode -@NoArgsConstructor -@AllArgsConstructor -@Setter -@Getter -public class Row { - - String key; - String type; - String condition; - String def; - String remark; - - public Row(String type) { - this.type = type; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java deleted file mode 100644 index d6be636389095d19d0b52185325ce0fc9fdb7e76..0000000000000000000000000000000000000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Section.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.apidoc.core.schema; - -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.common.QueryStringBuilder; -import com.apidoc.core.common.helper.StringHelper; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import lombok.Getter; -import lombok.Setter; - -import java.util.*; - -/** - * 小节,一个请求,封装为一个小节 - */ -@Setter -@Getter -public class Section extends Node { - - Method method; - String uri; - Map inHeaders = new LinkedHashMap<>(); - ObjectNode pathVariable = ObjectMappers.instance.createObjectNode(); - JsonNode parameter; - boolean queryParameter = true; - Map requestRows = new LinkedHashMap<>(); - - Map outHeaders = new LinkedHashMap<>(); - JsonNode response; - Map responseRows = new LinkedHashMap<>(); - Object rawResponse; - - public void addRequestRow(Row row){ - requestRows.put(row.getKey(), row); - } - - public void addRequestRows(Collection rows){ - for (Row row : rows) { - if(row.getKey()!=null && !requestRows.containsKey(row.getKey())){ - requestRows.put(row.getKey(),row); - } - } - } - - public String getRequestLine(){ - StringBuilder builder = new StringBuilder(this.method.toString()); - builder.append(" ").append(this.uri); - if(this.queryParameter && Objects.equals("GET", this.method)){ - String parameterString = getParameterString(); - if(StringHelper.nonBlank(parameterString)){ - builder.append("?").append(parameterString); - } - } - builder.append(" HTTP/1.1"); - return builder.toString(); - } - - public String getParameterString(){ - if(queryParameter && parameter instanceof ObjectNode){ - return new QueryStringBuilder().append((ObjectNode)parameter).toString(); - } - return ObjectMappers.pretty(parameter); - } - - public boolean hasRequestBody(){ - if(Objects.equals("GET",this.method)){ - return false; - } - return parameter!=null && parameter.size()>0; - } - - public void addResponseRow(Row row){ - responseRows.put(row.getKey(), row); - } - - public void addResponseRows(Collection rows){ - for (Row row : rows) { - if(row.getKey()!=null && !responseRows.containsKey(row.getKey())) { - responseRows.put(row.getKey(), row); - } - } - } - - public boolean hasResponseBody(){ - return response!=null || rawResponse!=null; - } - - public String getResponseString(){ - if(response!=null){ - return ObjectMappers.pretty(response); - } - return String.valueOf(rawResponse); - } - - public void addInHeader(Header header){ - if (!inHeaders.containsKey(header.getKey())) { - inHeaders.put(header.getKey(),header); - } - } - - public void addOutHeader(Header header){ - if (!outHeaders.containsKey(header.getKey())) { - outHeaders.put(header.getKey(),header); - } - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java b/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java deleted file mode 100644 index 81964c9d9cc98193267d0e35463db614466f736d..0000000000000000000000000000000000000000 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Tag.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.apidoc.core.schema; - -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -import java.util.Objects; - -/** - * //@param username 用户名 - * id key content - */ -@Slf4j -@Setter -@Getter -public class Tag { - - String id; - String key; - String content; - - public int getIntContent(int def){ - if (Objects.nonNull(content)) { - try{ - return Integer.parseInt(content); - }catch (Exception e){ - log.warn(content+" parse error"); - } - } - return def; - } - -} diff --git a/apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java b/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java similarity index 83% rename from apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java rename to apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java index 7912a315041b7d12e0f48fe8d3d10a1ca6942bfd..fc1219920cb473e267e625fe463999383d92e664 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/ApiDoc.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java @@ -1,11 +1,11 @@ -package com.apidoc.core; - -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.parser.ParserStrategy; -import com.apidoc.core.parser.VisitorParser; -import com.apidoc.core.render.ProjectRender; -import com.apidoc.core.resolver.TypeResolvers; -import com.apidoc.core.schema.Project; +package kim.apidoc.core; + +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.parser.ParserStrategy; +import kim.apidoc.core.parser.VisitorParser; +import kim.apidoc.core.render.ProjectRender; +import kim.apidoc.core.resolver.TypeResolvers; +import kim.apidoc.core.schema.Project; import com.github.javaparser.ParseResult; import com.github.javaparser.ParserConfiguration; import com.github.javaparser.ast.CompilationUnit; @@ -38,17 +38,6 @@ public class ApiDoc { * ApiDoc实例 */ private static ApiDoc INSTANCE; - - - /** - * Get instance api doc. - * - * @return the api doc - */ - public static ApiDoc getInstance(){ - return INSTANCE; - } - /** * 上下文 */ @@ -59,7 +48,6 @@ public class ApiDoc { */ @Getter private Project project = new Project(); - /** * The Visitor parser. */ @@ -68,7 +56,6 @@ public class ApiDoc { * The Parser configuration. */ private ParserConfiguration parserConfiguration; - /** * The Type resolvers. */ @@ -78,7 +65,7 @@ public class ApiDoc { /** * Instantiates a new ApiDoc. */ - private ApiDoc(){ + private ApiDoc() { init(new Context()); } @@ -87,16 +74,25 @@ public class ApiDoc { * * @param context the context */ - public ApiDoc(Context context){ + public ApiDoc(Context context) { init(context); } + /** + * Get instance api doc. + * + * @return the api doc + */ + public static ApiDoc getInstance() { + return INSTANCE; + } + /** * 初始化环境配置 * * @param context the context */ - private void init(Context context){ + private void init(Context context) { INSTANCE = this; this.context = context; project.setId(context.getId()); @@ -133,21 +129,21 @@ public class ApiDoc { * * @return the parser strategy */ - private ParserStrategy loadParserStrategy(){ + private ParserStrategy loadParserStrategy() { ServiceLoader serviceLoader = ServiceLoader.load(ParserStrategy.class); List strategies = Lists.newArrayList(serviceLoader); - if(strategies.isEmpty()){ + if (strategies.isEmpty()) { throw new IllegalArgumentException("no ParserStrategy implements found"); } - if(StringHelper.isBlank(context.framework)){ + if (StringHelper.isBlank(context.framework)) { return strategies.get(0); } for (ParserStrategy strategy : strategies) { - if(Objects.equals(context.framework,strategy.name())){ + if (Objects.equals(context.framework, strategy.name())) { return strategy; } } - throw new IllegalArgumentException("no ParserStrategy implements found for "+context.framework); + throw new IllegalArgumentException("no ParserStrategy implements found for " + context.framework); } /** @@ -155,12 +151,12 @@ public class ApiDoc { * * @return project project */ - public Project parse(){ + public Project parse() { for (Path source : this.context.getSources()) { SourceRoot root = new SourceRoot(source, parserConfiguration); try { for (ParseResult result : root.tryToParse()) { - if(result.isSuccessful() && result.getResult().isPresent()){ + if (result.isSuccessful() && result.getResult().isPresent()) { result.getResult().get().accept(visitorParser, project); } } @@ -174,7 +170,7 @@ public class ApiDoc { /** * 渲染解析结果 */ - public void render(){ + public void render() { for (ProjectRender render : this.context.getRenders()) { render.render(project); } diff --git a/apidoc-core/src/main/java/com/apidoc/core/Context.java b/apidoc-core/src/main/java/kim/apidoc/core/Context.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/Context.java rename to apidoc-core/src/main/java/kim/apidoc/core/Context.java index eef875dd674bc0a1943f492bb666445fb0aeea86..01d1ed0b71557a6c943a8386d388ada8c7b9c4a9 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/Context.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/Context.java @@ -1,9 +1,9 @@ -package com.apidoc.core; +package kim.apidoc.core; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.render.AsciiDocRender; -import com.apidoc.core.render.PostmanRender; -import com.apidoc.core.render.ProjectRender; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.render.AsciiDocRender; +import kim.apidoc.core.render.PostmanRender; +import kim.apidoc.core.render.ProjectRender; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/Assert.java b/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/Assert.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java index 4c4bc5bd4100d54bf7341f34776978288d51db71..a98d17de84a4be9fd5600e27239c2709cd0fb539 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/Assert.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java b/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java index 0f2407ba0ab1f7c22c102dac36be42b57254b85b..685cb2675022c4e7f905fe18d95d602f30f5f980 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/ObjectMappers.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java index 3dd22570ea04d7fe35d1a308bdabd7f1c6efaa43..9cfafa525618afbc46a178dbb54cf65c181bd2d8 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/QueryStringBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/URI.java b/apidoc-core/src/main/java/kim/apidoc/core/common/URI.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/common/URI.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/URI.java index c34de99778a35df298f3595a58c68dd471283de8..909071c54cd8ff0ddcd34f1fa524a4fac634667a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/URI.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/URI.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common; +package kim.apidoc.core.common; -import com.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.common.helper.StringHelper; import com.google.common.collect.Lists; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java similarity index 64% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java index a26eb64a1c2bb3f9a2bb9bc36143ee2f15e2bde9..8359d867265950a3290151edfd732b5cbdb9e8d2 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/ArrayTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.schema.Row; import com.fasterxml.jackson.databind.node.ArrayNode; import java.util.ArrayList; @@ -15,47 +15,47 @@ public class ArrayTypeDescription extends TypeDescription { public ArrayTypeDescription(TypeDescription component) { this.component = component; this.value = ObjectMappers.instance.createArrayNode(); - if(component.isAvailable()){ + if (component.isAvailable()) { this.type = component.getType() + "[]"; - if(component.isPrimitive()){ + if (component.isPrimitive()) { primitive(component.asPrimitive()); - }else if(component.isString()){ + } else if (component.isString()) { value.add(component.asString().getValue()); - }else if(component.isArray()){ + } else if (component.isArray()) { value.add(component.asArray().getValue()); - }else if(component.isObject()){ + } else if (component.isObject()) { value.add(component.asObject().getValue()); } - }else{ + } else { this.type = "[]"; } } - public void primitive(PrimitiveTypeDescription typeDescription){ - switch (typeDescription.getType()){ + public void primitive(PrimitiveTypeDescription typeDescription) { + switch (typeDescription.getType()) { case "byte": - value.add((byte)typeDescription.getValue()); + value.add((byte) typeDescription.getValue()); break; case "short": - value.add((short)typeDescription.getValue()); + value.add((short) typeDescription.getValue()); break; case "char": - value.add((char)typeDescription.getValue()); + value.add((char) typeDescription.getValue()); break; case "int": - value.add((int)typeDescription.getValue()); + value.add((int) typeDescription.getValue()); break; case "long": - value.add((long)typeDescription.getValue()); + value.add((long) typeDescription.getValue()); break; case "boolean": - value.add((boolean)typeDescription.getValue()); + value.add((boolean) typeDescription.getValue()); break; case "float": - value.add((float)typeDescription.getValue()); + value.add((float) typeDescription.getValue()); break; case "double": - value.add((double)typeDescription.getValue()); + value.add((double) typeDescription.getValue()); break; } } @@ -76,17 +76,17 @@ public class ArrayTypeDescription extends TypeDescription { } } - public ArrayNode getValue(){ + public ArrayNode getValue() { return value; } @Override public Collection rows() { ArrayList rows = new ArrayList<>(); - if(key != null){ + if (key != null) { rows.addAll(super.rows()); } - if(component.isAvailable()){ + if (component.isAvailable()) { rows.addAll(component.rows()); } return rows; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java index e4a248938b28ab613d5f4491bdbdd7d591ec2672..f614fd1185f6b412944c0bab26d850874db0e47a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/ObjectTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.schema.Row; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; import lombok.Getter; @@ -14,9 +14,8 @@ import java.util.List; @Getter public class ObjectTypeDescription extends TypeDescription { - private ObjectNode value = ObjectMappers.instance.createObjectNode(); - protected List members = Lists.newArrayList(); + private ObjectNode value = ObjectMappers.instance.createObjectNode(); public void merge(ObjectTypeDescription other) { value.setAll(other.getValue()); @@ -87,6 +86,7 @@ public class ObjectTypeDescription extends TypeDescription { } } + @Override public ObjectNode getValue() { return value; } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java index 99d13487377e3f7349950ec849d1d0743dfacc03..0eb349e1dca943836e0cc8460444ea3cc098f17a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/PrimitiveTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; import com.github.javaparser.resolution.types.ResolvedPrimitiveType; import com.github.javaparser.resolution.types.ResolvedReferenceType; @@ -6,8 +6,8 @@ import com.github.javaparser.resolution.types.ResolvedReferenceType; public class PrimitiveTypeDescription extends TypeDescription { - public PrimitiveTypeDescription(ResolvedReferenceType referenceType){ - switch (referenceType.getId()){ + public PrimitiveTypeDescription(ResolvedReferenceType referenceType) { + switch (referenceType.getId()) { case "java.lang.Byte": value = (byte) 0; type = "byte"; @@ -33,7 +33,7 @@ public class PrimitiveTypeDescription extends TypeDescription { type = "double"; break; case "java.lang.Character": - value = (char)0; + value = (char) 0; type = "char"; break; case "java.lang.Boolean": @@ -43,9 +43,10 @@ public class PrimitiveTypeDescription extends TypeDescription { } } - public PrimitiveTypeDescription(ResolvedPrimitiveType resolvedPrimitiveType){ + + public PrimitiveTypeDescription(ResolvedPrimitiveType resolvedPrimitiveType) { type = resolvedPrimitiveType.describe(); - switch (resolvedPrimitiveType){ + switch (resolvedPrimitiveType) { case BYTE: value = (byte) 0; break; @@ -65,7 +66,7 @@ public class PrimitiveTypeDescription extends TypeDescription { value = 0d; break; case CHAR: - value = (char)0; + value = (char) 0; break; case BOOLEAN: value = false; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java similarity index 64% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java index ad56e82dfc9f688cca0850f86c71316597b9fb8a..f8d589bab3b63419f39f7c3148151496255b2252 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/StringTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; public class StringTypeDescription extends TypeDescription { @@ -7,7 +7,8 @@ public class StringTypeDescription extends TypeDescription { value = charSequence.toString(); } - public String getValue(){ - return (String)value; + @Override + public String getValue() { + return (String) value; } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java similarity index 79% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java index eee1377600b5a08bcd9b5cbc5361aad6f5038d7c..57b7cc9899e73d93f58a6d14af27b30c687ae784 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/TypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.schema.Row; import com.google.common.collect.Lists; import lombok.Getter; import lombok.Setter; @@ -61,36 +61,36 @@ public abstract class TypeDescription { return (ObjectTypeDescription) this; } - public void addRemark(String value){ - if(value==null){ + public void addRemark(String value) { + if (value == null) { return; } - if(remark==null){ + if (remark == null) { remark = value; - }else{ + } else { remark += " " + value; } } - public String fullKey(){ - return StringHelper.join(".",prefix,key); + public String fullKey() { + return StringHelper.join(".", prefix, key); } public Collection rows() { String key = fullKey(); - if(StringHelper.isBlank(key)){ + if (StringHelper.isBlank(key)) { return Lists.newArrayList(); } String def; - if(defaultValue!=null){ + if (defaultValue != null) { def = String.valueOf(defaultValue); - }else if(value!=null){ + } else if (value != null) { def = String.valueOf(value); - }else{ + } else { def = ""; } - if(required!=null){ + if (required != null) { condition.append("required=").append(required); } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java b/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java similarity index 85% rename from apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java index 2e18b8abb80fc7d46fbcc9f862b554d289628550..d40e90eced44253601cbe9b9c5beb59cc5c1e87f 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/description/UnAvailableTypeDescription.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.description; +package kim.apidoc.core.common.description; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Row; import java.util.Collection; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java index a1be9ee954316757f96079c4d2f96a15061970ee..52b5806f9164b69e5c8d4e0fb63ba6e340287f5a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileMatcher.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import com.google.common.base.Charsets; import lombok.Getter; @@ -42,7 +42,7 @@ public class FileMatcher { return changs; } - public void rederHtml(Path templateHtml, Path resultHtml) { + public void renderHtml(Path templateHtml, Path resultHtml) { String results = matchPatcher.diff_prettyHtml(diffs); String[] lines = br(results).replaceAll("|", "").split("\n"); String html = readFile(templateHtml); diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java similarity index 90% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java index 83c9797c9e4418dd513f6a6585dcb188be0ad067..447274b5a02fde6847ccbf9cbb6a3e6cf20c39ed 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/FileSystem.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import java.awt.*; import java.io.File; @@ -9,7 +9,7 @@ import java.nio.file.Path; public class FileSystem { public static boolean open(Path path) { - if(!Files.exists(path)){ + if (!Files.exists(path)) { return false; } if (cmd(path.toString())) { @@ -25,8 +25,8 @@ public class FileSystem { private static boolean cmd(String command, String args) { try { - Process p = Runtime.getRuntime().exec(new String[]{command,args}); - return p!=null; + Process p = Runtime.getRuntime().exec(new String[]{command, args}); + return p != null; } catch (IOException e) { e.printStackTrace(); } @@ -45,6 +45,14 @@ public class FileSystem { return false; } + private static OS currentOS() { + String s = System.getProperty("os.name").toLowerCase(); + if (s.contains("win")) { + return OS.win; + } + return OS.mac; + } + public enum OS { mac("open"), win("explorer"); @@ -55,17 +63,9 @@ public class FileSystem { this.command = command; } - public String getCommand(){ + public String getCommand() { return command; } } - - private static OS currentOS() { - String s = System.getProperty("os.name").toLowerCase(); - if (s.contains("win")) { - return OS.win; - } - return OS.mac; - } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java similarity index 99% rename from apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java index 7c2adf53ae063aaecdf79101e5b658f9f108725d..0d0da4bc588c2cf6a406a6e4d8a3aecbc66e1b90 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/diff/MatchPatcher.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.apidoc.core.common.diff; +package kim.apidoc.core.common.diff; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java index ffd5a50bfb84fd210fc23a796473689aa4ec1f02..4304fec5608b1dba3dfaf9a342867891d74f833c 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/AnnotationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.expr.*; import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java index 9ad45908444fb5ff4a3bdb384c7258c36f5c5f2c..cc0a05fbc6d2b478e8d81ee06a3a3fa274f07636 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ClassDeclarationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.FieldDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java index 414216f042c62063377eff61618b9d9f21ae411b..86234f2e97f7dac8cdf774ce67bfd1bf15fda942 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CommentHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java index e362e99a9aa49666e5a963a6718f44ee9916f930..5cd759171ea9c48c14fc3e56e17c8566190f31ac 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/CompilationUnitHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.Node; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java index f381b49a70f6adc2016d8d2963d71421d53164aa..13adf03728573a7fd19dd6c94302b2645b9007a5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ExpressionHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.expr.*; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java index e68f3ccaf1644c3dc3f27ceb4dbba819c1fd5bde..fcb8c5358e0c6d42a61597104c933e2c270e8537 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FieldHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java index 65b7ef73de09d1cb56e5100e34d7a16988b3067c..7a780362ff5cf30f317b550d67e7b2cbdc2d03c5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/FileHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java index 2e8a6c10767cb2520006e672c4e1ca98d51e5cd1..63c748a33bb75c190790fe1ae80f2e46afa53edc 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/JsonPropertyHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.expr.AnnotationExpr; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java index 830c9f76fa7688b1a6282b16d3dd4a430156dda9..661243d053b931c4dcbd3faea249f2af17cf5c46 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/OptionalHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import java.util.Optional; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java index fe3294d1c051fce32d2ed55815a19790cd734a17..20daa4003c59902da6d0dea9aed2b68a5bfebacd 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ReferenceContext.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.collect.Sets; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java index 40f2e971e396df4019feb8705e8cd68f212d049e..08e98fecde7b66c21e357d3ae92dcacc7c1ff69b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/StringHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java index 59a42c978c5a672dc12d51c97259a81fc264cdf2..38efcaf93321e99709eab27e241f7b3436b3fb65 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeNameHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.ImportDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java index fb055dc9eb33a47c884b1d25c40e6d28d40e477a..722d0b0f9ac59f713536f2e5171f5892b359e76c 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/TypeParameterHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration; import com.github.javaparser.resolution.types.ResolvedReferenceType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java index 7e2ccfd244fe630cd0ca8443c9fa1a6870ba9585..0d42101ec92bc8a62035b85982a3a98122f6f9fc 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/helper/ValidationHelper.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.helper; +package kim.apidoc.core.common.helper; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.expr.AnnotationExpr; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java index 98c2aa487303d91c57817910edba437d696d2888..0dd0a03d7790b7f8f65410b6d94218feb5c0c4bc 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/MarkupBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.markup; +package kim.apidoc.core.common.markup; -import com.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; +import kim.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; import java.util.List; import java.util.function.Consumer; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java similarity index 97% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java index db39dae5eab48a7eb49d6c88607ef8b7e417bcd9..18e4ca4fbecb72ba53f424a8617c71fb1e3e9b1d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDoc.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; public enum AsciiDoc implements CharSequence { EXTENSION(".adoc"), diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java similarity index 98% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java index 0ba3cd61efc12d6482d8b79fd756c1d70a193f63..5d95e67a0d69a81907f4ff42a6b9035e78555bf8 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; -import com.apidoc.core.common.Assert; -import com.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.Assert; +import kim.apidoc.core.common.markup.MarkupBuilder; import com.google.common.base.Strings; import java.util.List; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java index 836e8db53b1e95d00897e207e5c2fbe5d65f30ae..301f70e651886ae45864ff413165f1fbb3f98735 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/asciidoc/Color.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.asciidoc; +package kim.apidoc.core.common.markup.asciidoc; /** * https://en.wikipedia.org/wiki/Web_colors#HTML_color_names diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java similarity index 96% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java index f31b1612fedc5491165efeef67464279e81d6976..22f00147c86f26352ff50fd526f04ca2fca4cea3 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/Markdown.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.markup.markdown; +package kim.apidoc.core.common.markup.markdown; public enum Markdown implements CharSequence { EXTENSION(".md"), diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java similarity index 75% rename from apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java index d31fc0504eb51646cfadfb527e8cef2cf4279009..2b012d59b5bdbd60e5d145870773ea9d87cb4511 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/markup/markdown/MarkdownBuilder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java @@ -1,15 +1,13 @@ -package com.apidoc.core.common.markup.markdown; +package kim.apidoc.core.common.markup.markdown; -import com.apidoc.core.common.Assert; -import com.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.Assert; +import kim.apidoc.core.common.markup.MarkupBuilder; import com.google.common.base.Strings; import java.util.List; import java.util.function.Consumer; import java.util.regex.Matcher; -import static com.apidoc.core.common.markup.markdown.Markdown.*; - public class MarkdownBuilder implements MarkupBuilder { public static final int MAX_TITLE = 6; @@ -19,7 +17,7 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder header(String text, CharSequence... attrs) { Assert.notBlank(text, "header must not be blank"); - content.append(HEADER); + content.append(Markdown.HEADER); content.append(nobr(text.trim())); br(); return this; @@ -30,7 +28,7 @@ public class MarkdownBuilder implements MarkupBuilder { Assert.notBlank(text, "header must not be blank"); Assert.between(level, 1, MAX_TITLE, "title level can not be " + level); br(); - content.append(Strings.repeat(TITLE.toString(), level + 1)).append(WHITESPACE) + content.append(Strings.repeat(Markdown.TITLE.toString(), level + 1)).append(Markdown.WHITESPACE) .append(nobr(text.trim())); br(); return this; @@ -67,35 +65,35 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder note(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder tip(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder important(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder warning(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @Override public MarkupBuilder caution(String text) { - content.append(QUOTE); + content.append(Markdown.QUOTE); paragraph(text); return this; } @@ -114,42 +112,42 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder listing(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder literal(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder sidebar(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder comment(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder passthrough(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder quote(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder example(Consumer consumer, CharSequence... attrs) { - return block(consumer, LISTING, attrs); + return block(consumer, Markdown.LISTING, attrs); } @Override public MarkupBuilder list(String text) { - return list(text, LIST_FLAG); + return list(text, Markdown.LIST_FLAG); } @Override @@ -187,28 +185,28 @@ public class MarkdownBuilder implements MarkupBuilder { public MarkupBuilder table(List> data, boolean header, boolean footer) { for (int i = 0; i < data.size(); i++) { - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { String value = data.get(i).get(j); if(value!=null){ - content.append(data.get(i).get(j).replace(TABLE_CELL, "\\" + TABLE_CELL)); + content.append(data.get(i).get(j).replace(Markdown.TABLE_CELL, "\\" + Markdown.TABLE_CELL)); }else{ content.append(" "); } - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); } br(); if(i==0 && header){ - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { - content.append(TABLE_Header); + content.append(Markdown.TABLE_Header); } br(); } if(i==data.size()-2 && footer){ - content.append(TABLE_CELL); + content.append(Markdown.TABLE_CELL); for (int j = 0; j < data.get(i).size(); j++) { - content.append(TABLE_Header); + content.append(Markdown.TABLE_Header); } br(); } @@ -231,55 +229,55 @@ public class MarkdownBuilder implements MarkupBuilder { @Override public MarkupBuilder emphasized(String text, CharSequence... textStyle) { - return style(EMPHASIZED, text, textStyle); + return style(Markdown.EMPHASIZED, text, textStyle); } @Override public MarkupBuilder strong(String text, CharSequence... textStyle) { - return style(STRONG, text, textStyle); + return style(Markdown.STRONG, text, textStyle); } @Override public MarkupBuilder monospaced(String text, CharSequence... textStyle) { - return style(MONOSPACED, text, textStyle); + return style(Markdown.MONOSPACED, text, textStyle); } @Override public MarkupBuilder quoted(String text, CharSequence... textStyle) { - return style(QUOTE, text, textStyle); + return style(Markdown.QUOTE, text, textStyle); } @Override public MarkupBuilder doubleQuoted(String text, CharSequence... textStyle) { - return style(DOUBLE_QUOTED, text, textStyle); + return style(Markdown.DOUBLE_QUOTED, text, textStyle); } @Override public MarkupBuilder unquoted(String text, CharSequence... textStyle) { - return style(UNQUOTED, text, textStyle); + return style(Markdown.UNQUOTED, text, textStyle); } @Override public MarkupBuilder br() { - content.append(BR); + content.append(Markdown.BR); return this; } @Override public MarkupBuilder hbr() { - content.append(HBR); + content.append(Markdown.HBR); return this; } @Override public MarkupBuilder newLine() { - content.append(NEW_LINE); + content.append(Markdown.NEW_LINE); return this; } @Override public MarkupBuilder pageBreak() { - content.append(PAGEBREAKS); + content.append(Markdown.PAGEBREAKS); br(); return this; } @@ -298,8 +296,8 @@ public class MarkdownBuilder implements MarkupBuilder { if (Assert.isBlank(content)) { return content; } - return content.replaceAll(BR.toString(), - Matcher.quoteReplacement(WHITESPACE.toString())); + return content.replaceAll(Markdown.BR.toString(), + Matcher.quoteReplacement(Markdown.WHITESPACE.toString())); } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java index 810f97136466c588a663f1c889ca2d7a0d238c50..47487e575bb2b7370a7a29333a7129290a7c853d 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Body.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java similarity index 71% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java index 19bbd0eceb99bbf7cffe8a6ce5fbc194707daf49..7d56b3c4e50f4ee16dacce10222fa037ec5a74c0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/BodyMode.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; /** * 对应postman定义的mode diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java similarity index 88% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java index 2634775bba232f847e6cca4af7b7b5750422e63a..8620ef9c34ec38bceea73d8ad56b51954cea2390 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Folder.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java similarity index 86% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java index f53cbc88cd11f3e27988782b91e5b6a41dccc09e..5fceb856b60eff85f9a7d5a00013b31c90d23be0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Info.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java index 6473b404c6fffa6fd01b4fe434dfc369bacdae68..4a25b191da786339d5db137acb69e5102567a05a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Item.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java similarity index 86% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java index adc2cfb2e06ebd0f3e3e69fd4b2c6f15a4deee1c..5f3baf7637e6e3fc0be678e9f464df9f87470658 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Parameter.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Row; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java index 3fac52aaf5e40ffac8b4f8b41b68cc3c77324676..549e7a9a315a0cf688bf45fe2f190338a4160e0b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Postman.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java similarity index 70% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java index 8aa7db8fdab7251c335526c51c3bc2286ffa75b5..6ddf403cfbce920e6b114eb4c1b93316c91efd7a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Request.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java @@ -1,7 +1,7 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Header; -import com.apidoc.core.schema.Method; +import kim.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Method; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java similarity index 81% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java index bec12b1747cca92e7feba24cc1f3d0dbd72cea4f..3854cda0f508b355ffbdea2c1b0ee7a69a6a35ec 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Response.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java @@ -1,6 +1,6 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; -import com.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Header; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java rename to apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java index b1925f682d1a63991a4fe1882f4a67943b8e4b23..5fc565dcd4fd4cf0844ecaea9c862acb5363396c 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/common/postman/Url.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java @@ -1,4 +1,4 @@ -package com.apidoc.core.common.postman; +package kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java b/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java similarity index 90% rename from apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java rename to apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java index 4f88c3cd85146aada0bcf63aa616c3d52378d0a9..699a3a0c786aa7f0e462cc8c812dac0634509ce3 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/parser/ParserStrategy.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java @@ -1,7 +1,7 @@ -package com.apidoc.core.parser; +package kim.apidoc.core.parser; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Section; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; diff --git a/apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java b/apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java rename to apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java index 0fb25788577678f1c3902c251fd45fb79e8277f2..bcc4817f67f7377446911a63a675f9206aa7f618 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/parser/VisitorParser.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java @@ -1,10 +1,10 @@ -package com.apidoc.core.parser; +package kim.apidoc.core.parser; -import com.apidoc.core.common.helper.OptionalHelper; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Node; -import com.apidoc.core.schema.Project; -import com.apidoc.core.schema.Section; +import kim.apidoc.core.common.helper.OptionalHelper; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Node; +import kim.apidoc.core.schema.Project; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java index 61f75df2f596110e2c3e0c8bd8a7b82ba5957cda..c1e7b249dd5f9788d6a3e8753ea61f0e19f7ae7b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/AsciiDocRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java @@ -1,12 +1,12 @@ -package com.apidoc.core.render; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.common.markup.MarkupBuilder; -import com.apidoc.core.common.markup.asciidoc.AsciiDoc; -import com.apidoc.core.schema.*; +package kim.apidoc.core.render; + +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.common.markup.MarkupBuilder; +import kim.apidoc.core.common.markup.asciidoc.AsciiDoc; import com.google.common.collect.Lists; +import kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java new file mode 100644 index 0000000000000000000000000000000000000000..739d24a8a39856f65f8ac726d8d0dbdbd2e8b4b1 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java @@ -0,0 +1,18 @@ +package kim.apidoc.core.render; + +import kim.apidoc.core.schema.Project; + +/** + * 生成markdown api文档 + * + * @author duanledexianxianxian + * @version 1.0.0 + * @date 2020 /3/26 19:03 + * @since 1.0.0 + */ +public class MarkdownRender implements ProjectRender { + @Override + public void render(Project project) { + + } +} diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java similarity index 94% rename from apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java index 64a5b6347f0e3456023e0e94cd464c8fa101ff62..1afe2df0c8db978a78c2346995f6749390a92e79 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/PostmanRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java @@ -1,11 +1,11 @@ -package com.apidoc.core.render; +package kim.apidoc.core.render; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.ObjectMappers; -import com.apidoc.core.common.helper.FileHelper; -import com.apidoc.core.common.postman.*; -import com.apidoc.core.schema.*; import com.fasterxml.jackson.databind.node.ObjectNode; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.common.helper.FileHelper; +import kim.apidoc.core.common.postman.*; +import kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import java.nio.file.Path; diff --git a/apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java b/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java similarity index 74% rename from apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java rename to apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java index b1541f6fd6ad8eac1dc6e6eb9d02385b4665abb7..2e126666f448a2f0cfcefd7808ca01ddc57e0977 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/render/ProjectRender.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java @@ -1,6 +1,6 @@ -package com.apidoc.core.render; +package kim.apidoc.core.render; -import com.apidoc.core.schema.Project; +import kim.apidoc.core.schema.Project; /** * The interface Project render. diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java similarity index 69% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java index 55c4ba8b4b12c9b7237df73f6777037fd8168253..db9e2c6913183603098cac52dce0facd2ad721f5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/ArrayTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java @@ -1,8 +1,8 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.ArrayTypeDescription; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.ArrayTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public class ArrayTypeResolver implements TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java similarity index 80% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java index 2723e0d1c747643d0b56e4ec058b5de731460c33..89e6356f3597bd0b232099b47547fff74fbde7d3 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/CollectionTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java @@ -1,10 +1,10 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.helper.TypeParameterHelper; -import com.apidoc.core.common.description.ArrayTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.helper.TypeParameterHelper; +import kim.apidoc.core.common.description.ArrayTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java similarity index 84% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java index 93cfad10c3d8eb6d700ba9e9f546b06ee1c79bc1..b163b84fe80dc4328ff0ff3688de639ba6d411ef 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/DateTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java similarity index 85% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java index 3863c131e6e38dc0b0aa5a577773e10303cbcd49..613803396bc2df374d1787127ba942afe7007d32 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/EnumTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.StringTypeDescription; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.declarations.ResolvedEnumConstantDeclaration; import com.github.javaparser.resolution.declarations.ResolvedEnumDeclaration; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java similarity index 73% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java index 2855dcda870d7a8edc95b4f1bb25072de5bd4e37..9cba7e118263a9de9d0a1417e3a89d911423f077 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/MapTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; @@ -9,24 +9,14 @@ import com.google.common.collect.ImmutableList; * 不支持直接使用Map,建议使用DTO */ public class MapTypeResolver implements TypeResolver { - @Override - public boolean accept(ResolvedType type) { - return isMap(type); - } - - @Override - public TypeDescription resolve(ResolvedType type) { - return new UnAvailableTypeDescription(); - } - - private static boolean isMap(ResolvedType type){ - if(!type.isReferenceType()){ + private static boolean isMap(ResolvedType type) { + if (!type.isReferenceType()) { return false; } return isMap(type.asReferenceType().getId()); } - private static boolean isMap(String id){ + private static boolean isMap(String id) { return ImmutableList.of("java.util.Map", "java.util.HashMap", "java.util.Hashtable", @@ -35,4 +25,14 @@ public class MapTypeResolver implements TypeResolver { "java.lang.TreeMap" ).contains(id); } + + @Override + public boolean accept(ResolvedType type) { + return isMap(type); + } + + @Override + public TypeDescription resolve(ResolvedType type) { + return new UnAvailableTypeDescription(); + } } diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java similarity index 93% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java index 8117ea2d67d4fb5187207ad22cdba141663390fb..b9302f976c61c1a719a2c02db1727a96915cd44a 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/ObjectTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java @@ -1,12 +1,12 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.ObjectTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.*; import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration; import com.github.javaparser.resolution.types.ResolvedReferenceType; import com.github.javaparser.resolution.types.ResolvedType; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.ObjectTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.*; import java.util.Optional; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java similarity index 87% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java index 790bedaa9de6addf647c07f9613730084783a600..cdd456b013db60a102efb75f320aeb4361e10807 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/PrimitiveTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.PrimitiveTypeDescription; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.PrimitiveTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java similarity index 82% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java index 4557b44907f9f00284cb2c7f8b06d32cfd5176bc..b2942c49a44c5c2331aedabbdee2c8ce4976e711 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/StringTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.StringTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.StringTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; import com.google.common.collect.ImmutableList; diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java similarity index 81% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java index fabfa4066ccd4f9d41c4ee0c88d8b024891696f6..5fe5e565976882135f6e991c8276f4d052e1b7fb 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/SystemObjectTypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java @@ -1,7 +1,7 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public class SystemObjectTypeResolver implements TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java similarity index 62% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java index ae5c4e0960051d51ee0027bae15db1e8325c4676..7a12503427889e4028263ea83c0bf06dc18472e0 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeNameResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java @@ -1,6 +1,6 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.ast.type.Type; public interface TypeNameResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java similarity index 66% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java index ce68789cd8e485cf65385d83852fc0526438bb75..469a6916c05020e8beab1310f34af58045e800c1 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolver.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java @@ -1,6 +1,6 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public interface TypeResolver { diff --git a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java similarity index 92% rename from apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java rename to apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java index 4b5ca96f26d7ebd48bc58313857bd876154218bd..fc8a6b1ce656d9bca5b9514734e964fcb8f54070 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/resolver/TypeResolvers.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java @@ -1,8 +1,8 @@ -package com.apidoc.core.resolver; +package kim.apidoc.core.resolver; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.TypeNameHelper; -import com.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.TypeNameHelper; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; import com.github.javaparser.ast.type.Type; import com.github.javaparser.resolution.UnsolvedSymbolException; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Book.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java similarity index 54% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Book.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java index 02f01510e0a33fd1cebf8d944acf5494b87c14d2..99b9eddefef6863228e85f30ff96e0e5d46b19b8 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Book.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -6,14 +6,31 @@ import lombok.Setter; import java.util.Set; import java.util.TreeSet; +/** + * The type Book. + * + * @author fengyuchenglun + * @version 1.0.0 + */ @Setter @Getter public class Book extends Node { + /** + * The constant DEFAULT. + */ public static final String DEFAULT = "index"; + /** + * 章 + */ Set chapters = new TreeSet<>(); + /** + * Instantiates a new Book. + * + * @param id the id + */ public Book(String id) { this.id = id; } diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java similarity index 62% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java index 102097926bbc2e4ea2c080bc48077bb4768f5f4c..59e699d6d45876278d64af6036e6ced381ab494b 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Chapter.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -8,13 +8,22 @@ import java.util.TreeSet; /** * 章,一个类解析为一章 + * + * @author fengyuchenglun + * @version 1.0.0 */ @Setter @Getter public class Chapter extends Node { + /** + * The Book name. + */ String bookName; + /** + * The Sections. + */ Set
sections = new TreeSet<>(); } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java new file mode 100644 index 0000000000000000000000000000000000000000..962f0f21f08a16ef3c46f4518382d9f31d86ee8e --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java @@ -0,0 +1,72 @@ +package kim.apidoc.core.schema; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * The type Header. + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Setter +@Getter +@NoArgsConstructor +public class Header { + + /** + * The constant APPLICATION_JSON. + */ + public static final Header APPLICATION_JSON = new Header("Content-Type", "application/json"); + /** + * The constant X_FORM_WWW_URLENCODED. + */ + public static final Header X_FORM_WWW_URLENCODED = new Header("Content-Type", "x-www-form-urlencoded"); + + /** + * The Key. + */ + String key; + /** + * The Value. + */ + String value; + /** + * The Description. + */ + String description; + + /** + * Instantiates a new Header. + * + * @param key the key + * @param value the value + */ + public Header(String key, String value) { + this.key = key; + this.value = value; + } + + /** + * Value of header. + * + * @param text the text + * @return the header + */ + public static Header valueOf(String text) { + String[] arr = text.split(":"); + Header header = new Header(); + header.setKey(arr[0]); + if (arr.length > 1) { + header.setValue(arr[1]); + } + return header; + } + + @Override + public String toString() { + return key + ": " + value; + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java new file mode 100644 index 0000000000000000000000000000000000000000..4cf18f6372119525e7e0d75f4400620dda24fb37 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java @@ -0,0 +1,84 @@ +package kim.apidoc.core.schema; + +import lombok.extern.slf4j.Slf4j; + +/** + * 支持的http method + * @author fengyuchenglun + */ +@Slf4j +public enum Method { + + + /** + * Get method. + */ + GET, + /** + * Post method. + */ + POST, + /** + * Put method. + */ + PUT, + /** + * Delete method. + */ + DELETE, + /** + * Options method. + */ + OPTIONS, + /** + * Patch method. + */ + PATCH, + /** + * Copy method. + */ + COPY, + /** + * Head method. + */ + HEAD, + /** + * Link method. + */ + LINK, + /** + * Unlink method. + */ + UNLINK, + /** + * Purge method. + */ + PURGE, + /** + * Lock method. + */ + LOCK, + /** + * Unlock method. + */ + UNLOCK, + /** + * Propfind method. + */ + PROPFIND, + /** + * View method. + */ + VIEW; + + /** + * Of method. + * + * @param name the name + * @return the method + */ + public static Method of(String name) { + return valueOf(name); + } + +} diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Node.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java similarity index 95% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Node.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java index 8ebcefe11e91eaa96004476473c1ea4462f0cb82..0abf6c1f287c9a6cb2305efc13b9ebdf9c5a3347 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Node.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java @@ -1,8 +1,8 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; -import com.apidoc.core.Context; -import com.apidoc.core.common.helper.CommentHelper; -import com.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.Context; +import kim.apidoc.core.common.helper.CommentHelper; +import kim.apidoc.core.common.helper.StringHelper; import com.github.javaparser.ast.comments.Comment; import com.github.javaparser.javadoc.Javadoc; import lombok.Getter; diff --git a/apidoc-core/src/main/java/com/apidoc/core/schema/Project.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java similarity index 89% rename from apidoc-core/src/main/java/com/apidoc/core/schema/Project.java rename to apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java index 5935f6869fa45b98b00e71108f67242e56d7b5c7..6cbf3fb7f5a8250974b0e262a28ff41ca0c383b5 100644 --- a/apidoc-core/src/main/java/com/apidoc/core/schema/Project.java +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java @@ -1,4 +1,4 @@ -package com.apidoc.core.schema; +package kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; @@ -31,7 +31,7 @@ public class Project extends Node { * @param chapter the chapter */ public void addChapter(Chapter chapter) { - if(Objects.isNull(chapter.getBookName())){ + if (Objects.isNull(chapter.getBookName())) { chapter.setBookName(Book.DEFAULT); } if (!books.containsKey(chapter.getBookName())) { diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java new file mode 100644 index 0000000000000000000000000000000000000000..b3ea98bfe17cd1c12215e187b74a334923d1b9f2 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java @@ -0,0 +1,48 @@ +package kim.apidoc.core.schema; + +import lombok.*; + +/** + * The type Row. + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class Row { + + /** + * The Key. + */ + String key; + /** + * The Type. + */ + String type; + /** + * The Condition. + */ + String condition; + /** + * The Def. + */ + String def; + /** + * The Remark. + */ + String remark; + + /** + * Instantiates a new Row. + * + * @param type the type + */ + public Row(String type) { + this.type = type; + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java new file mode 100644 index 0000000000000000000000000000000000000000..7dcff547dde9e8431be1b9de49a9a9f1041d2e29 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java @@ -0,0 +1,198 @@ +package kim.apidoc.core.schema; + +import kim.apidoc.core.common.ObjectMappers; +import kim.apidoc.core.common.QueryStringBuilder; +import kim.apidoc.core.common.helper.StringHelper; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.Getter; +import lombok.Setter; + +import java.util.*; + +/** + * 小节,一个请求,封装为一个小节 + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Setter +@Getter +public class Section extends Node { + + /** + * The Method. + */ + Method method; + /** + * The Uri. + */ + String uri; + /** + * The In headers. + */ + Map inHeaders = new LinkedHashMap<>(); + /** + * The Path variable. + */ + ObjectNode pathVariable = ObjectMappers.instance.createObjectNode(); + /** + * The Parameter. + */ + JsonNode parameter; + /** + * The Query parameter. + */ + boolean queryParameter = true; + /** + * The Request rows. + */ + Map requestRows = new LinkedHashMap<>(); + + /** + * The Out headers. + */ + Map outHeaders = new LinkedHashMap<>(); + /** + * The Response. + */ + JsonNode response; + /** + * The Response rows. + */ + Map responseRows = new LinkedHashMap<>(); + /** + * The Raw response. + */ + Object rawResponse; + + /** + * Add request row. + * + * @param row the row + */ + public void addRequestRow(Row row) { + requestRows.put(row.getKey(), row); + } + + /** + * Add request rows. + * + * @param rows the rows + */ + public void addRequestRows(Collection rows) { + for (Row row : rows) { + if (row.getKey() != null && !requestRows.containsKey(row.getKey())) { + requestRows.put(row.getKey(), row); + } + } + } + + /** + * Get request line string. + * + * @return the string + */ + public String getRequestLine() { + StringBuilder builder = new StringBuilder(this.method.toString()); + builder.append(" ").append(this.uri); + if (this.queryParameter && Objects.equals("GET", this.method)) { + String parameterString = getParameterString(); + if (StringHelper.nonBlank(parameterString)) { + builder.append("?").append(parameterString); + } + } + builder.append(" HTTP/1.1"); + return builder.toString(); + } + + /** + * Get parameter string string. + * + * @return the string + */ + public String getParameterString() { + if (queryParameter && parameter instanceof ObjectNode) { + return new QueryStringBuilder().append((ObjectNode) parameter).toString(); + } + return ObjectMappers.pretty(parameter); + } + + /** + * Has request body boolean. + * + * @return the boolean + */ + public boolean hasRequestBody() { + if (Objects.equals("GET", this.method)) { + return false; + } + return parameter != null && parameter.size() > 0; + } + + /** + * Add response row. + * + * @param row the row + */ + public void addResponseRow(Row row) { + responseRows.put(row.getKey(), row); + } + + /** + * Add response rows. + * + * @param rows the rows + */ + public void addResponseRows(Collection rows) { + for (Row row : rows) { + if (row.getKey() != null && !responseRows.containsKey(row.getKey())) { + responseRows.put(row.getKey(), row); + } + } + } + + /** + * Has response body boolean. + * + * @return the boolean + */ + public boolean hasResponseBody() { + return response != null || rawResponse != null; + } + + /** + * Get response string string. + * + * @return the string + */ + public String getResponseString() { + if (response != null) { + return ObjectMappers.pretty(response); + } + return String.valueOf(rawResponse); + } + + /** + * Add in header. + * + * @param header the header + */ + public void addInHeader(Header header) { + if (!inHeaders.containsKey(header.getKey())) { + inHeaders.put(header.getKey(), header); + } + } + + /** + * Add out header. + * + * @param header the header + */ + public void addOutHeader(Header header) { + if (!outHeaders.containsKey(header.getKey())) { + outHeaders.put(header.getKey(), header); + } + } + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java b/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java new file mode 100644 index 0000000000000000000000000000000000000000..753ae7c5ddd74cc1baefe8b2441447d861102043 --- /dev/null +++ b/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java @@ -0,0 +1,51 @@ +package kim.apidoc.core.schema; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +/** + * //@param username 用户名 + * id key content + * + * @author fengyuchenglun + * @version 1.0.0 + */ +@Slf4j +@Setter +@Getter +public class Tag { + + /** + * The Id. + */ + String id; + /** + * The Key. + */ + String key; + /** + * The Content. + */ + String content; + + /** + * Get int content int. + * + * @param def the def + * @return the int + */ + public int getIntContent(int def) { + if (Objects.nonNull(content)) { + try { + return Integer.parseInt(content); + } catch (Exception e) { + log.warn(content + " parse error"); + } + } + return def; + } + +} diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java similarity index 98% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java index c45f3a822bb782a309f9f4200911979a0a6df954..43901de731715a00e5167adb1fe4d85a6f5e038c 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/ParameterHelper.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/ParameterHelper.java @@ -1,4 +1,4 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.Parameter; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java similarity index 96% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java index 02c6afee4dbf114e794586414e923f12c4db0ae0..ba0aa40a336ab2eef65e8658e28f674ecf5ab71b 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/RequestMappingHelper.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java @@ -1,10 +1,10 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.common.URI; -import com.apidoc.core.common.helper.AnnotationHelper; -import com.apidoc.core.common.helper.ClassDeclarationHelper; -import com.apidoc.core.common.helper.ExpressionHelper; -import com.apidoc.core.schema.Method; +import kim.apidoc.core.common.URI; +import kim.apidoc.core.common.helper.AnnotationHelper; +import kim.apidoc.core.common.helper.ClassDeclarationHelper; +import kim.apidoc.core.common.helper.ExpressionHelper; +import kim.apidoc.core.schema.Method; import com.github.javaparser.ast.Node; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java similarity index 96% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java index 0b21ceb15136be30d13769670ab5f6ac8abe1407..e178cdb453b991b30c9308314bcf2cbf8447ae2b 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringMVCContext.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java @@ -1,6 +1,6 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.ApiDoc; +import kim.apidoc.core.ApiDoc; import com.google.common.collect.Lists; import lombok.Data; diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java similarity index 92% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java index d5e04fe0c8d5107ab54650b5a7aaa990b97b7c7c..091a26fd2eb4a7574bf0e4a5466bc6d5d3c1fb7b 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/SpringParser.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java @@ -1,18 +1,18 @@ -package com.apigcc.springmvc; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.URI; -import com.apidoc.core.common.description.ObjectTypeDescription; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.helper.AnnotationHelper; -import com.apidoc.core.common.helper.ExpressionHelper; -import com.apidoc.core.common.helper.StringHelper; -import com.apidoc.core.parser.ParserStrategy; -import com.apidoc.core.schema.Chapter; -import com.apidoc.core.schema.Header; -import com.apidoc.core.schema.Row; -import com.apidoc.core.schema.Section; -import com.apigcc.springmvc.resovler.SpringComponentTypeResolver; +package com.kim.apidoc.springmvc; + +import com.kim.apidoc.springmvc.resovler.SpringComponentTypeResolver; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.URI; +import kim.apidoc.core.common.description.ObjectTypeDescription; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.helper.AnnotationHelper; +import kim.apidoc.core.common.helper.ExpressionHelper; +import kim.apidoc.core.common.helper.StringHelper; +import kim.apidoc.core.parser.ParserStrategy; +import kim.apidoc.core.schema.Chapter; +import kim.apidoc.core.schema.Header; +import kim.apidoc.core.schema.Row; +import kim.apidoc.core.schema.Section; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.body.Parameter; @@ -22,9 +22,6 @@ import com.github.javaparser.ast.expr.Expression; import java.util.List; import java.util.Optional; -import static com.apigcc.springmvc.ParameterHelper.ANNOTATION_REQUEST_HEADER; -import static com.apigcc.springmvc.ParameterHelper.ANNOTATION_REQUEST_PARAM; - /** * spring 解析 @@ -196,7 +193,7 @@ public class SpringParser implements ParserStrategy { if (ParameterHelper.isRequestHeader(parameter)) { String key = parameter.getNameAsString(); String defaultValue = "{value}"; - AnnotationExpr annotationExpr = parameter.getAnnotationByName(ANNOTATION_REQUEST_HEADER).get(); + AnnotationExpr annotationExpr = parameter.getAnnotationByName(ParameterHelper.ANNOTATION_REQUEST_HEADER).get(); Optional valueOptional = AnnotationHelper.getAnyAttribute(annotationExpr, "value", "name"); if (valueOptional.isPresent()) { key = String.valueOf(ExpressionHelper.getValue(valueOptional.get())); @@ -260,7 +257,7 @@ public class SpringParser implements ParserStrategy { Object defaultValue = null; Boolean required = null; - Optional optional = parameter.getAnnotationByName(ANNOTATION_REQUEST_PARAM); + Optional optional = parameter.getAnnotationByName(ParameterHelper.ANNOTATION_REQUEST_PARAM); if (optional.isPresent()) { Optional valueOptional = AnnotationHelper.getAnyAttribute(optional.get(), "value", "name"); if (valueOptional.isPresent()) { diff --git a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java similarity index 82% rename from apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java rename to apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java index a589003811eec84409b923992815c7d6f3847445..7132860bc645ff94806be480a004bbf392464e07 100644 --- a/apidoc-springmvc/src/main/java/com/apigcc/springmvc/resovler/SpringComponentTypeResolver.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java @@ -1,11 +1,11 @@ -package com.apigcc.springmvc.resovler; - -import com.apidoc.core.ApiDoc; -import com.apidoc.core.common.description.TypeDescription; -import com.apidoc.core.common.description.UnAvailableTypeDescription; -import com.apidoc.core.common.helper.TypeParameterHelper; -import com.apidoc.core.resolver.TypeNameResolver; -import com.apidoc.core.resolver.TypeResolver; +package com.kim.apidoc.springmvc.resovler; + +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.common.description.TypeDescription; +import kim.apidoc.core.common.description.UnAvailableTypeDescription; +import kim.apidoc.core.common.helper.TypeParameterHelper; +import kim.apidoc.core.resolver.TypeNameResolver; +import kim.apidoc.core.resolver.TypeResolver; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.type.Type; import com.github.javaparser.resolution.types.ResolvedType; diff --git a/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy b/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy deleted file mode 100644 index 8c48b3a65529d35361c6211e3663d24de23843a7..0000000000000000000000000000000000000000 --- a/apidoc-springmvc/src/main/resources/META-INF/services/com.apidoc.core.parser.ParserStrategy +++ /dev/null @@ -1 +0,0 @@ -com.apigcc.springmvc.SpringParser \ No newline at end of file diff --git a/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy b/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy new file mode 100644 index 0000000000000000000000000000000000000000..18677454c50ec7a16e8b924404f73f4572f4a7ce --- /dev/null +++ b/apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy @@ -0,0 +1 @@ +com.kim.apidoc.springmvc.SpringParser \ No newline at end of file diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java similarity index 85% rename from apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java index 751dc720453d44b54888412767e4d1af86927d9c..7684aa0f6485515c3fe9a23f20c090b866351b87 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/ApigccTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java @@ -1,8 +1,8 @@ -package com.apigcc.example; +package com.kim.apidoc.example; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.Context; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.Context; import org.junit.Test; import java.nio.file.Paths; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java similarity index 94% rename from apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java index 94d0e6e5ba7e593a91ceb3d8681d735d367354cf..1b39ec982539a836b2f25f3389ac5829ab3d2f3b 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.annotation; +package com.kim.apidoc.example.annotation; import org.springframework.stereotype.Controller; import java.lang.annotation.ElementType; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java similarity index 90% rename from apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java index b1eef0125bcb0bcaa44e0bd6e5b3f674fd852dbd..ae1dd6400e1c3ddce9d0be7ea6404966d78b90b4 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/annotation/KimResponseBody.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/annotation/KimResponseBody.java @@ -1,4 +1,4 @@ -package com.apigcc.example.annotation; +package com.kim.apidoc.example.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java similarity index 80% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java index 8001de8f43728bc8755b2a4ea5fb5f1ed941fd7a..2e75f78fadd266f37515166198f07f98fa6a087f 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Code.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Code.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * @code diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java similarity index 74% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java index 746d2bae4bfc2452b5464384abe2803e80711b27..6d0a68522361970d14acf9e53f3dd8ec42e7e769 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Menu.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Menu.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java similarity index 88% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java index 66f421fd9b547af1f1b651c814f3cd67cd1c6a26..5a467ee17b5848b3d7d2087b625d6785169e3073 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Page.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Page.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java similarity index 80% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java index 92ae713b71b213aa0329e289838f1dae0ca8ccd5..fe8ab31ee15897f2f4600f52f3056714b4136d8b 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Query.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Query.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java similarity index 87% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java index f7ee9784edbb01bd70f64b7c4ac4b4326b45575c..b3f033fa79b0136a4449723be07baa4db53cc304 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/ResultData.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/ResultData.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java similarity index 76% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java index 6ef902b53b0ac86dd095d65c2d550eba0a4dd785..25bdd5c8a3218029718d54da1674563459af1dbc 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Role.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Role.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * 用户角色 diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java similarity index 77% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java index 3cef9c557706c63aec2fc34cfb676721ec58b3e3..38c34d4ba684ca57c20ac34dcc9147d6c081a1d9 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/StaticFinalCode.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/StaticFinalCode.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * @code diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java similarity index 87% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java index dfaf63afc0ed11992711ea0f7059237bb42b92b4..97b50a38ec6e42846ce9f103ad083b060c3c85bc 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/User.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/User.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java similarity index 89% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java index dcd96a290bce0a5eedf4a4d7c96b93cd84f568ee..cf56289851367c899e7013fdea6bb41374fa1ac6 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDTO.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDTO.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java similarity index 78% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java index c37c65f812d2ed1df184acb9fa8422e50c833175..fdc15d35a7cd80eb4ba7a1c5760c86be3970ed16 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserDetails.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserDetails.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; /** * 某些用户信息框架,如spring security的用户登录信息 diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java similarity index 75% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java index baf4e7b6ded6e650781a9f86c532e8431a6f3df2..401ad9d759721b1fd151c13a6554554da08cd633 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/UserQuery.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/UserQuery.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java similarity index 70% rename from apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java index 4f74b94237d6f29d5e6ca46644c2d5f267fa0c0f..f6127400bce4a1b14f23f7772e35dc0047374552 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/common/Wrapper.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/common/Wrapper.java @@ -1,4 +1,4 @@ -package com.apigcc.example.common; +package com.kim.apidoc.example.common; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java similarity index 79% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java index 3f52b1c4b561e00e287848b3384353b6472ce371..d32ddfdf7f69ef93da5c9fd2a713e7ee245e91c6 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/BaseController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/BaseController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring; +package com.kim.apidoc.example.spring; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java similarity index 70% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java index b30d526e469ca8b2cf065db197bb562b7a5e650c..4c7e733368df8f5e0117c1799925470f9a840cd0 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/AuthController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/AuthController.java @@ -1,7 +1,7 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.ResultData; -import com.apigcc.example.spring.BaseController; +import com.kim.apidoc.example.common.ResultData; +import com.kim.apidoc.example.spring.BaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java similarity index 78% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java index 4b84a0b84e3b73d7b95b05d00d683d9ca988d68d..d99b49dcc5ce1ff8694643ff3369331baebe5ae0 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/EmptyController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/EmptyController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java similarity index 81% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java index f2e611fccc24d71ed97f71a36a608a3097a43143..2ff3b75fab20c78a7976bbba23239f5ec19bb569 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/IgnoreController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/IgnoreController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java similarity index 82% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java index bfba70230e274f5f32d5bb46a9246812370746f7..dd1ab5971295eabdcae0ddd05d07cfb3b3dedf67 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/KimUserController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/KimUserController.java @@ -1,8 +1,8 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.annotation.KimController; -import com.apigcc.example.common.ResultData; -import com.apigcc.example.common.User; +import com.kim.apidoc.example.annotation.KimController; +import com.kim.apidoc.example.common.ResultData; +import com.kim.apidoc.example.common.User; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java similarity index 89% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java index 7b8b4363847616125f1b1676d9e9e1204e1db07a..e77340c7bacaecac3e6cb3a0ef6d1b4c5ba8d6de 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/PageController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/PageController.java @@ -1,10 +1,10 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.*; -import com.apigcc.example.spring.BaseController; -import com.apigcc.example.spring.hello.Greeting; import com.apigcc.model.Info; import com.apigcc.model.InfoQuery; +import com.kim.apidoc.example.common.*; +import com.kim.apidoc.example.spring.BaseController; +import com.kim.apidoc.example.spring.hello.Greeting; import org.jruby.ir.Tuple; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java similarity index 92% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java index 897f44bc4450c0558a286dd09072eb72d7b4fe70..b8746a27663efb93b6fbe2e2f6ab409022d31ca0 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/advanced/UserController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/advanced/UserController.java @@ -1,7 +1,7 @@ -package com.apigcc.example.spring.advanced; +package com.kim.apidoc.example.spring.advanced; -import com.apigcc.example.common.*; -import com.apigcc.example.spring.BaseController; +import com.kim.apidoc.example.common.*; +import com.kim.apidoc.example.spring.BaseController; import org.springframework.http.ResponseEntity; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java similarity index 84% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java index 2fda48e7ea65acf35e53badcfc1faebd9bc7be80..e0412f913f9d6b2784937ba737a394c84965d466 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/Greeting.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/Greeting.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.hello; +package com.kim.apidoc.example.spring.hello; public class Greeting { diff --git a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java similarity index 94% rename from apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java index c61c008b4f666a89b13ce391564a39a05fe0b8c6..9a74535349e7d3231530afd9693c2dd30e7b06f8 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/example/spring/hello/GreetingController.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/spring/hello/GreetingController.java @@ -1,4 +1,4 @@ -package com.apigcc.example.spring.hello; +package com.kim.apidoc.example.spring.hello; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; diff --git a/apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java similarity index 86% rename from apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java rename to apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java index c7a9288c39d9a5c9262e3a9c5c620d1989171538..f372c1d32b2d5cca2c2c115190ce45eb8e7aed5a 100644 --- a/apidoc-springmvc/src/test/java/com/apigcc/springmvc/SpringTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java @@ -1,8 +1,8 @@ -package com.apigcc.springmvc; +package com.kim.apidoc.springmvc; -import com.apidoc.core.ApiDoc; -import com.apidoc.core.Context; -import com.apidoc.core.common.diff.FileMatcher; +import kim.apidoc.core.ApiDoc; +import kim.apidoc.core.Context; +import kim.apidoc.core.common.diff.FileMatcher; import org.junit.Test; import java.io.IOException; @@ -17,7 +17,7 @@ public class SpringTest { Context context = new Context(); context.setId("test"); context.setName("测试项目"); - context.addSource(Paths.get("K:\\@project-dianli@\\apigcc\\apigcc-springmvc\\src\\test\\java")); + context.addSource(Paths.get("K:\\@project-dianli@\\tool\\apidoc\\apidoc-springmvc\\src\\test\\java")); // context.setCss("https://darshandsoni.com/asciidoctor-skins/css/monospace.css"); ApiDoc apigcc = new ApiDoc(context); @@ -47,7 +47,7 @@ public class SpringTest { FileMatcher fileMatcher = new FileMatcher(); int changed = fileMatcher.compare(template, buildAdoc); if(changed>0){ - fileMatcher.rederHtml(templateHtml, resultHtml); + fileMatcher.renderHtml(templateHtml, resultHtml); } System.out.println("BUILD SUCCESS"); @@ -76,7 +76,7 @@ public class SpringTest { FileMatcher fileMatcher = new FileMatcher(); int changed = fileMatcher.compare(template, buildAdoc); if(changed>0){ - fileMatcher.rederHtml(templateHtml, resultHtml); + fileMatcher.renderHtml(templateHtml, resultHtml); } System.out.println("BUILD SUCCESS"); diff --git "a/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" "b/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" index ead46e3b3944de27c95613b2eba76844a4e922ed..a596775fc9361d929f551a187e95e6766de47c49 100644 --- "a/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" +++ "b/markdown\346\216\245\345\217\243\346\250\241\347\211\210.md" @@ -56,9 +56,9 @@ POST /api/v1/users HTTP/1.1 } ``` -| Field | Type | Condition | Default | Description | -| :------- | :----- | :-------- | :------ | :---------- | -| loginId | String | | | 用户编号 | -| userName | String | | | 用户名 | -| password | String | | | 密码 | +| Field | Type | Description | +| :------- | :----- | :---------- | +| loginId | String | 用户编号 | +| userName | String | 用户名 | +| password | String | 密码 |