From 2e5785bf3d85564ffdf841013fab4ec14d537fb1 Mon Sep 17 00:00:00 2001 From: duanledexianxianxian Date: Fri, 27 Mar 2020 01:57:07 +0800 Subject: [PATCH] :recycle: Refactoring code. --- apidoc-core/build.gradle | 1 + .../{ => com}/kim/apidoc/core/ApiDoc.java | 22 ++--- .../{ => com}/kim/apidoc/core/Context.java | 36 +++++--- .../kim/apidoc/core/common/Assert.java | 2 +- .../com/kim/apidoc/core/common/Constants.java | 19 +++++ .../kim/apidoc/core/common/ObjectMappers.java | 2 +- .../core/common/QueryStringBuilder.java | 2 +- .../{ => com}/kim/apidoc/core/common/URI.java | 4 +- .../description/ArrayTypeDescription.java | 6 +- .../description/ObjectTypeDescription.java | 6 +- .../description/PrimitiveTypeDescription.java | 2 +- .../description/StringTypeDescription.java | 2 +- .../common/description/TypeDescription.java | 6 +- .../UnAvailableTypeDescription.java | 4 +- .../apidoc/core/common/diff/FileMatcher.java | 2 +- .../apidoc/core/common/diff/FileSystem.java | 2 +- .../apidoc/core/common/diff/MatchPatcher.java | 2 +- .../core/common/helper/AnnotationHelper.java | 2 +- .../common/helper/ClassDeclarationHelper.java | 2 +- .../core/common/helper/CommentHelper.java | 2 +- .../common/helper/CompilationUnitHelper.java | 2 +- .../core/common/helper/ExpressionHelper.java | 2 +- .../core/common/helper/FieldHelper.java | 2 +- .../apidoc/core/common/helper/FileHelper.java | 6 +- .../common/helper/JsonPropertyHelper.java | 2 +- .../core/common/helper/OptionalHelper.java | 2 +- .../core/common/helper/ReferenceContext.java | 2 +- .../core/common/helper/StringHelper.java | 2 +- .../core/common/helper/TypeNameHelper.java | 2 +- .../common/helper/TypeParameterHelper.java | 2 +- .../core/common/helper/ValidationHelper.java | 2 +- .../core/common/markup/MarkupBuilder.java | 4 +- .../core/common/markup/asciidoc/AsciiDoc.java | 2 +- .../markup/asciidoc/AsciiDocBuilder.java | 6 +- .../core/common/markup/asciidoc/Color.java | 2 +- .../core/common/markup/markdown/Markdown.java | 2 +- .../markup/markdown/MarkdownBuilder.java | 6 +- .../kim/apidoc/core/common/postman/Body.java | 2 +- .../apidoc/core/common/postman/BodyMode.java | 2 +- .../apidoc/core/common/postman/Folder.java | 2 +- .../kim/apidoc/core/common/postman/Info.java | 2 +- .../kim/apidoc/core/common/postman/Item.java | 2 +- .../apidoc/core/common/postman/Parameter.java | 4 +- .../apidoc/core/common/postman/Postman.java | 2 +- .../apidoc/core/common/postman/Request.java | 6 +- .../apidoc/core/common/postman/Response.java | 4 +- .../kim/apidoc/core/common/postman/Url.java | 2 +- .../apidoc/core/parser/ParserStrategy.java | 6 +- .../kim/apidoc/core/parser/VisitorParser.java | 12 +-- .../apidoc/core/render/AsciiDocRender.java | 22 ++--- .../apidoc/core/render/MarkdownRender.java | 60 ++++++++++++++ .../kim/apidoc/core/render/PostmanRender.java | 30 +++---- .../kim/apidoc/core/render/ProjectRender.java | 4 +- .../core/resolver/ArrayTypeResolver.java | 8 +- .../core/resolver/CollectionTypeResolver.java | 12 +-- .../core/resolver/DateTypeResolver.java | 6 +- .../core/resolver/EnumTypeResolver.java | 6 +- .../apidoc/core/resolver/MapTypeResolver.java | 6 +- .../core/resolver/ObjectTypeResolver.java | 10 +-- .../core/resolver/PrimitiveTypeResolver.java | 6 +- .../core/resolver/StringTypeResolver.java | 6 +- .../resolver/SystemObjectTypeResolver.java | 6 +- .../core/resolver/TypeNameResolver.java | 4 +- .../apidoc/core/resolver/TypeResolver.java | 4 +- .../apidoc/core/resolver/TypeResolvers.java | 8 +- .../kim/apidoc/core/schema/Book.java | 2 +- .../kim/apidoc/core/schema/Chapter.java | 2 +- .../kim/apidoc/core/schema/Header.java | 2 +- .../kim/apidoc/core/schema/Method.java | 2 +- .../kim/apidoc/core/schema/Node.java | 8 +- .../kim/apidoc/core/schema/Project.java | 2 +- .../{ => com}/kim/apidoc/core/schema/Row.java | 2 +- .../kim/apidoc/core/schema/Section.java | 8 +- .../{ => com}/kim/apidoc/core/schema/Tag.java | 2 +- .../apidoc/core/render/MarkdownRender.java | 18 ---- .../src/main/resources/templates/markdown.ftl | 83 +++++++++++++++++++ .../springmvc/RequestMappingHelper.java | 10 +-- .../apidoc/springmvc/SpringMVCContext.java | 2 +- .../kim/apidoc/springmvc/SpringParser.java | 24 +++--- .../resovler/SpringComponentTypeResolver.java | 12 +-- ...com.kim.apidoc.core.parser.ParserStrategy} | 0 .../com/kim/apidoc/example/ApigccTest.java | 4 +- .../com/kim/apidoc/springmvc/SpringTest.java | 6 +- ...45\345\217\243\346\250\241\347\211\210.md" | 14 ++-- 84 files changed, 390 insertions(+), 231 deletions(-) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/ApiDoc.java (90%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/Context.java (73%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/Assert.java (94%) create mode 100644 apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/ObjectMappers.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/QueryStringBuilder.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/URI.java (93%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/ArrayTypeDescription.java (95%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/ObjectTypeDescription.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/PrimitiveTypeDescription.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/StringTypeDescription.java (86%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/TypeDescription.java (94%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/description/UnAvailableTypeDescription.java (83%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/diff/FileMatcher.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/diff/FileSystem.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/diff/MatchPatcher.java (99%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/AnnotationHelper.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/ClassDeclarationHelper.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/CommentHelper.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/CompilationUnitHelper.java (92%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/ExpressionHelper.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/FieldHelper.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/FileHelper.java (85%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/JsonPropertyHelper.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/OptionalHelper.java (88%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/ReferenceContext.java (94%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/StringHelper.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/TypeNameHelper.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/TypeParameterHelper.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/helper/ValidationHelper.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/MarkupBuilder.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/asciidoc/Color.java (94%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/markdown/Markdown.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java (98%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Body.java (86%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/BodyMode.java (69%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Folder.java (87%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Info.java (85%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Item.java (89%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Parameter.java (85%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Postman.java (88%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Request.java (68%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Response.java (79%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/common/postman/Url.java (86%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/parser/ParserStrategy.java (89%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/parser/VisitorParser.java (90%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/render/AsciiDocRender.java (90%) create mode 100644 apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/render/PostmanRender.java (83%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/render/ProjectRender.java (72%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/ArrayTypeResolver.java (67%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/CollectionTypeResolver.java (78%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/DateTypeResolver.java (83%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/EnumTypeResolver.java (84%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/MapTypeResolver.java (84%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/ObjectTypeResolver.java (92%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/PrimitiveTypeResolver.java (86%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/StringTypeResolver.java (81%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/SystemObjectTypeResolver.java (79%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/TypeNameResolver.java (61%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/TypeResolver.java (64%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/resolver/TypeResolvers.java (91%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Book.java (93%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Chapter.java (91%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Header.java (97%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Method.java (96%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Node.java (94%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Project.java (95%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Row.java (94%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Section.java (95%) rename apidoc-core/src/main/java/{ => com}/kim/apidoc/core/schema/Tag.java (95%) delete mode 100644 apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java create mode 100644 apidoc-core/src/main/resources/templates/markdown.ftl rename apidoc-springmvc/src/main/resources/META-INF/services/{kim.apidoc.core.parser.ParserStrategy => com.kim.apidoc.core.parser.ParserStrategy} (100%) diff --git a/apidoc-core/build.gradle b/apidoc-core/build.gradle index 2a1eec7..dffa1ee 100644 --- a/apidoc-core/build.gradle +++ b/apidoc-core/build.gradle @@ -2,4 +2,5 @@ dependencies { compile 'com.github.javaparser:javaparser-symbol-solver-core:3.14.4' compile 'com.fasterxml.jackson.core:jackson-databind:2.5.2' compile 'org.asciidoctor:asciidoctorj:2.1.0' + compile group: 'org.freemarker', name: 'freemarker', version: '2.3.30' } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java b/apidoc-core/src/main/java/com/kim/apidoc/core/ApiDoc.java similarity index 90% rename from apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/ApiDoc.java index fc12199..6984ddd 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/ApiDoc.java @@ -1,11 +1,11 @@ -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; +package com.kim.apidoc.core; + +import com.kim.apidoc.core.common.helper.StringHelper; +import com.kim.apidoc.core.parser.ParserStrategy; +import com.kim.apidoc.core.parser.VisitorParser; +import com.kim.apidoc.core.render.ProjectRender; +import com.kim.apidoc.core.resolver.TypeResolvers; +import com.kim.apidoc.core.schema.Project; import com.github.javaparser.ParseResult; import com.github.javaparser.ParserConfiguration; import com.github.javaparser.ast.CompilationUnit; @@ -135,15 +135,15 @@ public class ApiDoc { if (strategies.isEmpty()) { throw new IllegalArgumentException("no ParserStrategy implements found"); } - if (StringHelper.isBlank(context.framework)) { + if (StringHelper.isBlank(context.getFramework())) { return strategies.get(0); } for (ParserStrategy strategy : strategies) { - if (Objects.equals(context.framework, strategy.name())) { + if (Objects.equals(context.getFramework(), strategy.name())) { return strategy; } } - throw new IllegalArgumentException("no ParserStrategy implements found for " + context.framework); + throw new IllegalArgumentException("no ParserStrategy implements found for " + context.getFramework()); } /** diff --git a/apidoc-core/src/main/java/kim/apidoc/core/Context.java b/apidoc-core/src/main/java/com/kim/apidoc/core/Context.java similarity index 73% rename from apidoc-core/src/main/java/kim/apidoc/core/Context.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/Context.java index 01d1ed0..4b2dc19 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/Context.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/Context.java @@ -1,11 +1,12 @@ -package kim.apidoc.core; +package com.kim.apidoc.core; -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 com.kim.apidoc.core.common.helper.FileHelper; +import com.kim.apidoc.core.render.AsciiDocRender; +import com.kim.apidoc.core.render.MarkdownRender; +import com.kim.apidoc.core.render.PostmanRender; +import com.kim.apidoc.core.render.ProjectRender; import lombok.Getter; import lombok.Setter; @@ -14,6 +15,8 @@ import java.nio.file.Paths; import java.util.List; import java.util.Map; +import static com.kim.apidoc.core.common.Constants.MARKDOWN_TEMPLATE; + /** * The type Context. * @@ -44,15 +47,16 @@ public class Context { * 设置当前解析框架 */ @Setter - public String framework; + private String framework; /** * The Renders. */ @Setter - public List renders = Lists.newArrayList( + private List renders = Lists.newArrayList( new AsciiDocRender(), - new PostmanRender()); + new PostmanRender(), + new MarkdownRender()); /** * 编译目录 @@ -102,17 +106,24 @@ public class Context { @Setter private String css; + + /** + * markdown模版文件路径 + */ + @Setter + private String markdownTemplate = MARKDOWN_TEMPLATE; + /** * 自定义扩展参数 */ - private Map ext= Maps.newHashMap(); + private Map ext = Maps.newHashMap(); /** * Add source. * * @param path the path */ - public void addSource(Path path){ + public void addSource(Path path) { sources.add(path); sources.addAll(FileHelper.find(path, DEFAULT_CODE_STRUCTURE)); addDependency(path); @@ -123,7 +134,7 @@ public class Context { * * @param path the path */ - public void addDependency(Path path){ + public void addDependency(Path path) { dependencies.add(path); dependencies.addAll(FileHelper.find(path, DEFAULT_CODE_STRUCTURE)); } @@ -133,10 +144,9 @@ public class Context { * * @param path the path */ - public void addJar(Path path){ + public void addJar(Path path) { jars.add(path); } - } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/Assert.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/Assert.java index a98d17d..ea8bcb2 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/Assert.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common; +package com.kim.apidoc.core.common; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java new file mode 100644 index 0000000..a28605a --- /dev/null +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java @@ -0,0 +1,19 @@ +package com.kim.apidoc.core.common; + +import java.nio.charset.StandardCharsets; + +/** + * 常量类 + * + * @author duanledexianxianxian + * @version 1.0.0 + * @date 2020 /3/26 23:00 + * @since 1.0.0 + */ +public class Constants { + public static final String UTF8 = StandardCharsets.UTF_8.name(); + public static final String SLASH = "/"; + public static final String MARKDOWN_EXTENSION = ".md"; + public static final String MARKDOWN_TEMPLATE = "/templates/markdown.ftl"; + +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/ObjectMappers.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/ObjectMappers.java index 685cb26..d8fa44b 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/ObjectMappers.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common; +package com.kim.apidoc.core.common; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/QueryStringBuilder.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/QueryStringBuilder.java index 9cfafa5..1bfb727 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/QueryStringBuilder.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common; +package com.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/kim/apidoc/core/common/URI.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/URI.java similarity index 93% rename from apidoc-core/src/main/java/kim/apidoc/core/common/URI.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/URI.java index 909071c..c053981 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/URI.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/URI.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.common; +package com.kim.apidoc.core.common; -import kim.apidoc.core.common.helper.StringHelper; +import com.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/kim/apidoc/core/common/description/ArrayTypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ArrayTypeDescription.java similarity index 95% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ArrayTypeDescription.java index 8359d86..6ce2452 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ArrayTypeDescription.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; -import kim.apidoc.core.common.ObjectMappers; -import kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.common.ObjectMappers; import com.fasterxml.jackson.databind.node.ArrayNode; import java.util.ArrayList; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ObjectTypeDescription.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ObjectTypeDescription.java index f614fd1..d3a07c7 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ObjectTypeDescription.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; -import kim.apidoc.core.common.ObjectMappers; -import kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.common.ObjectMappers; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; import lombok.Getter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/PrimitiveTypeDescription.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/PrimitiveTypeDescription.java index 0eb349e..56d88b2 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/PrimitiveTypeDescription.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; import com.github.javaparser.resolution.types.ResolvedPrimitiveType; import com.github.javaparser.resolution.types.ResolvedReferenceType; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/StringTypeDescription.java similarity index 86% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/StringTypeDescription.java index f8d589b..81ba7db 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/StringTypeDescription.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; public class StringTypeDescription extends TypeDescription { diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/TypeDescription.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/TypeDescription.java index 57b7cc9..7771898 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/TypeDescription.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; -import kim.apidoc.core.common.helper.StringHelper; -import kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.common.helper.StringHelper; import com.google.common.collect.Lists; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/UnAvailableTypeDescription.java similarity index 83% rename from apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/description/UnAvailableTypeDescription.java index d40e90e..a294121 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/description/UnAvailableTypeDescription.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.common.description; +package com.kim.apidoc.core.common.description; -import kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.schema.Row; import java.util.Collection; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileMatcher.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileMatcher.java index 52b5806..14031b8 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileMatcher.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.diff; +package com.kim.apidoc.core.common.diff; import com.google.common.base.Charsets; import lombok.Getter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileSystem.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileSystem.java index 447274b..0f6115f 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileSystem.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.diff; +package com.kim.apidoc.core.common.diff; import java.awt.*; import java.io.File; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/MatchPatcher.java similarity index 99% rename from apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/MatchPatcher.java index 0d0da4b..311bf40 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java +++ b/apidoc-core/src/main/java/com/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 kim.apidoc.core.common.diff; +package com.kim.apidoc.core.common.diff; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/AnnotationHelper.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/AnnotationHelper.java index 4304fec..3f1aecc 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/AnnotationHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/ClassDeclarationHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ClassDeclarationHelper.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ClassDeclarationHelper.java index cc0a05f..2734e86 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ClassDeclarationHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/CommentHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CommentHelper.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CommentHelper.java index 86234f2..5bebdc3 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CommentHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/CompilationUnitHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CompilationUnitHelper.java similarity index 92% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CompilationUnitHelper.java index 5cd7591..1fe7fd5 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CompilationUnitHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/ExpressionHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ExpressionHelper.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ExpressionHelper.java index 13adf03..a208309 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ExpressionHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/FieldHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FieldHelper.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FieldHelper.java index fcb8c53..598b214 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FieldHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/FileHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FileHelper.java similarity index 85% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FileHelper.java index 7a78036..59247b8 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FileHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.kim.apidoc.core.common.helper; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; @@ -32,10 +32,10 @@ public class FileHelper { } } - public static List find(Path start, String structure){ + public static List find(Path start, String structure) { try { return Files.walk(start) - .filter(p->p.endsWith(structure)).collect(Collectors.toList()); + .filter(p -> p.endsWith(structure)).collect(Collectors.toList()); } catch (IOException e) { log.warn("find path error:{} {}", start, e.getMessage()); } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/JsonPropertyHelper.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/JsonPropertyHelper.java index 63c748a..447b79d 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/JsonPropertyHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/OptionalHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/OptionalHelper.java similarity index 88% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/OptionalHelper.java index 661243d..a99b6ec 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/OptionalHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.kim.apidoc.core.common.helper; import java.util.Optional; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ReferenceContext.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ReferenceContext.java index 20daa40..8ef8fcd 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ReferenceContext.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.kim.apidoc.core.common.helper; import com.google.common.collect.Sets; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/StringHelper.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/StringHelper.java index 08e98fe..b6c3093 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/StringHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.kim.apidoc.core.common.helper; import com.google.common.base.Strings; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeNameHelper.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeNameHelper.java index 38efcaf..64fef12 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeNameHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/TypeParameterHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeParameterHelper.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeParameterHelper.java index 722d0b0..42ad047 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeParameterHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/helper/ValidationHelper.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ValidationHelper.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ValidationHelper.java index 0d42101..44f849b 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ValidationHelper.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.helper; +package com.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/kim/apidoc/core/common/markup/MarkupBuilder.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/MarkupBuilder.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/MarkupBuilder.java index 0dd0a03..629ef8f 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/MarkupBuilder.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.common.markup; +package com.kim.apidoc.core.common.markup; -import kim.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; +import com.kim.apidoc.core.common.markup.asciidoc.AsciiDocBuilder; import java.util.List; import java.util.function.Consumer; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java index 18e4ca4..c114e5e 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.markup.asciidoc; +package com.kim.apidoc.core.common.markup.asciidoc; public enum AsciiDoc implements CharSequence { EXTENSION(".adoc"), diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java index 5d95e67..9642f9a 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.markup.asciidoc; +package com.kim.apidoc.core.common.markup.asciidoc; -import kim.apidoc.core.common.Assert; -import kim.apidoc.core.common.markup.MarkupBuilder; +import com.kim.apidoc.core.common.markup.MarkupBuilder; +import com.kim.apidoc.core.common.Assert; import com.google.common.base.Strings; import java.util.List; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/Color.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/Color.java index 301f70e..b7ca387 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/Color.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.markup.asciidoc; +package com.kim.apidoc.core.common.markup.asciidoc; /** * https://en.wikipedia.org/wiki/Web_colors#HTML_color_names diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/Markdown.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/Markdown.java index 22f0014..8fdb93f 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/Markdown.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.markup.markdown; +package com.kim.apidoc.core.common.markup.markdown; public enum Markdown implements CharSequence { EXTENSION(".md"), diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java similarity index 98% rename from apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java index 2b012d5..1c80669 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.markup.markdown; +package com.kim.apidoc.core.common.markup.markdown; -import kim.apidoc.core.common.Assert; -import kim.apidoc.core.common.markup.MarkupBuilder; +import com.kim.apidoc.core.common.markup.MarkupBuilder; +import com.kim.apidoc.core.common.Assert; import com.google.common.base.Strings; import java.util.List; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Body.java similarity index 86% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Body.java index 47487e5..b3a32fe 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Body.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/BodyMode.java similarity index 69% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/BodyMode.java index 7d56b3c..3972bd9 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/BodyMode.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; /** * 对应postman定义的mode diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Folder.java similarity index 87% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Folder.java index 8620ef9..be112fb 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Folder.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Info.java similarity index 85% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Info.java index 5fceb85..32ea847 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Info.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Item.java similarity index 89% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Item.java index 4a25b19..9cd90f5 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Item.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Parameter.java similarity index 85% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Parameter.java index 5f3baf7..26f8aaa 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Parameter.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; -import kim.apidoc.core.schema.Row; +import com.kim.apidoc.core.schema.Row; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Postman.java similarity index 88% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Postman.java index 549e7a9..1d6be5d 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Postman.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Request.java similarity index 68% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Request.java index 6ddf403..e54cbcb 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Request.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; -import kim.apidoc.core.schema.Header; -import kim.apidoc.core.schema.Method; +import com.kim.apidoc.core.schema.Header; +import com.kim.apidoc.core.schema.Method; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Response.java similarity index 79% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Response.java index 3854cda..b8ef739 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Response.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; -import kim.apidoc.core.schema.Header; +import com.kim.apidoc.core.schema.Header; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Url.java similarity index 86% rename from apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Url.java index 5fc565d..3cb84e0 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Url.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.common.postman; +package com.kim.apidoc.core.common.postman; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java b/apidoc-core/src/main/java/com/kim/apidoc/core/parser/ParserStrategy.java similarity index 89% rename from apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/parser/ParserStrategy.java index 699a3a0..f7e3331 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/parser/ParserStrategy.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.parser; +package com.kim.apidoc.core.parser; -import kim.apidoc.core.schema.Chapter; -import kim.apidoc.core.schema.Section; +import com.kim.apidoc.core.schema.Chapter; +import com.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/kim/apidoc/core/parser/VisitorParser.java b/apidoc-core/src/main/java/com/kim/apidoc/core/parser/VisitorParser.java similarity index 90% rename from apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/parser/VisitorParser.java index 8567ecc..cb4176b 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/parser/VisitorParser.java @@ -1,10 +1,10 @@ -package kim.apidoc.core.parser; +package com.kim.apidoc.core.parser; -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.kim.apidoc.core.schema.Chapter; +import com.kim.apidoc.core.schema.Node; +import com.kim.apidoc.core.schema.Project; +import com.kim.apidoc.core.schema.Section; +import com.kim.apidoc.core.common.helper.OptionalHelper; 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/kim/apidoc/core/render/AsciiDocRender.java b/apidoc-core/src/main/java/com/kim/apidoc/core/render/AsciiDocRender.java similarity index 90% rename from apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/render/AsciiDocRender.java index c1e7b24..491dc2e 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/render/AsciiDocRender.java @@ -1,12 +1,12 @@ -package kim.apidoc.core.render; +package com.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 com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.helper.FileHelper; +import com.kim.apidoc.core.common.helper.StringHelper; +import com.kim.apidoc.core.common.markup.MarkupBuilder; +import com.kim.apidoc.core.common.markup.asciidoc.AsciiDoc; +import com.kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; @@ -46,7 +46,7 @@ public class AsciiDocRender implements ProjectRender { project.getBooks().forEach((name, book) -> { MarkupBuilder builder = MarkupBuilder.getInstance(); String displayName = project.getName(); - if(!Objects.equals(Book.DEFAULT, name)){ + if (!Objects.equals(Book.DEFAULT, name)) { displayName += " - " + name; } builder.header(displayName, attrs); @@ -61,7 +61,7 @@ public class AsciiDocRender implements ProjectRender { builder.title(1, chapter.getName()); builder.paragraph(chapter.getDescription()); for (Section section : chapter.getSections()) { - if(section.isIgnore()){ + if (section.isIgnore()) { continue; } builder.title(2, section.getName()); @@ -71,7 +71,7 @@ public class AsciiDocRender implements ProjectRender { builder.title(4, "request"); builder.listing(b -> { b.textLine(section.getRequestLine()); - section.getInHeaders().values().forEach(header->builder.textLine(header.toString())); + section.getInHeaders().values().forEach(header -> builder.textLine(header.toString())); if (section.hasRequestBody()) { b.br(); b.text(section.getParameterString()); @@ -87,7 +87,7 @@ public class AsciiDocRender implements ProjectRender { if (section.hasResponseBody()) { b.br(); b.text(section.getResponseString()); - }else{ + } else { b.text("N/A"); } }, "source,JSON"); diff --git a/apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java b/apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java new file mode 100644 index 0000000..b5d698d --- /dev/null +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java @@ -0,0 +1,60 @@ +package com.kim.apidoc.core.render; + +import com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.Constants; +import com.kim.apidoc.core.schema.Project; +import freemarker.template.Configuration; +import freemarker.template.Template; +import lombok.extern.slf4j.Slf4j; + +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.nio.file.Path; + + +/** + * 生成markdown api文档 + * + * @author duanledexianxianxian + * @version 1.0.0 + * @date 2020 /3/26 19:03 + * @since 1.0.0 + */ +@Slf4j +public class MarkdownRender implements ProjectRender { + private Configuration configuration; + + public MarkdownRender init() { + configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); + configuration.setDefaultEncoding(Constants.UTF8); + configuration.setClassForTemplateLoading(MarkdownRender.class, Constants.SLASH); + return this; + } + + + @Override + public void render(Project project) { + this.init(); + try { + this.build(project); + } catch (Exception e) { + log.error("Build Markdown Fail {}", e.getMessage()); + } + } + + private void build(Project project) throws Exception { + String templatePath = ApiDoc.getInstance().getContext().getMarkdownTemplate(); + String id = ApiDoc.getInstance().getContext().getId(); + Path buildPath = ApiDoc.getInstance().getContext().getBuildPath(); + Path markdownFile = buildPath.resolve(id).resolve(id + Constants.MARKDOWN_EXTENSION); + + Template template = configuration.getTemplate(templatePath); + + try (FileOutputStream fileOutputStream = new FileOutputStream(markdownFile.toString())) { + template.process(project, new OutputStreamWriter(fileOutputStream, Constants.UTF8)); + } + + log.info("Build Markdown {}", markdownFile); + + } +} diff --git a/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java b/apidoc-core/src/main/java/com/kim/apidoc/core/render/PostmanRender.java similarity index 83% rename from apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/render/PostmanRender.java index 1afe2df..325add5 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/render/PostmanRender.java @@ -1,11 +1,11 @@ -package kim.apidoc.core.render; +package com.kim.apidoc.core.render; 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 com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.ObjectMappers; +import com.kim.apidoc.core.common.helper.FileHelper; +import com.kim.apidoc.core.common.postman.*; +import com.kim.apidoc.core.schema.*; import lombok.extern.slf4j.Slf4j; import java.nio.file.Path; @@ -38,14 +38,14 @@ public class PostmanRender implements ProjectRender { Folder folder = new Folder(); folder.setName(book.getId()); for (Chapter chapter : book.getChapters()) { - if(chapter.isIgnore() || chapter.getSections().isEmpty()){ + if (chapter.isIgnore() || chapter.getSections().isEmpty()) { continue; } Folder chapterFolder = new Folder(); chapterFolder.setName(chapter.getName()); chapterFolder.setDescription(chapter.getDescription()); for (Section section : chapter.getSections()) { - if(section.isIgnore()){ + if (section.isIgnore()) { continue; } chapterFolder.getItem().add(build(section)); @@ -55,7 +55,7 @@ public class PostmanRender implements ProjectRender { postman.getItem().add(folder); } - if(postman.getItem().size()==1){ + if (postman.getItem().size() == 1) { Folder folder = postman.getItem().get(0); postman.setItem(folder.getItem()); } @@ -74,18 +74,18 @@ public class PostmanRender implements ProjectRender { request.setMethod(section.getMethod()); request.getHeaders().addAll(section.getInHeaders().values()); - if(section.isQueryParameter()){ - if(Method.GET.equals(request.getMethod())){ - ObjectNode objectNode = (ObjectNode)section.getParameter(); + if (section.isQueryParameter()) { + if (Method.GET.equals(request.getMethod())) { + ObjectNode objectNode = (ObjectNode) section.getParameter(); for (String key : section.getRequestRows().keySet()) { if (objectNode.has(key)) { Row row = section.getRequestRows().get(key); request.getUrl().getQuery().add(Parameter.of(row)); } } - }else{ + } else { request.getBody().setMode(BodyMode.urlencoded); - ObjectNode objectNode = (ObjectNode)section.getParameter(); + ObjectNode objectNode = (ObjectNode) section.getParameter(); for (String key : section.getRequestRows().keySet()) { if (objectNode.has(key)) { Row row = section.getRequestRows().get(key); @@ -93,7 +93,7 @@ public class PostmanRender implements ProjectRender { } } } - }else{ + } else { request.getBody().setMode(BodyMode.raw); request.getBody().setRaw(section.getParameterString()); } diff --git a/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java b/apidoc-core/src/main/java/com/kim/apidoc/core/render/ProjectRender.java similarity index 72% rename from apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/render/ProjectRender.java index 2e12666..c2c3661 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/render/ProjectRender.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.render; +package com.kim.apidoc.core.render; -import kim.apidoc.core.schema.Project; +import com.kim.apidoc.core.schema.Project; /** * The interface Project render. diff --git a/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ArrayTypeResolver.java similarity index 67% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ArrayTypeResolver.java index db9e2c6..76f2296 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ArrayTypeResolver.java @@ -1,8 +1,8 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.ApiDoc; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.description.ArrayTypeDescription; +import com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/CollectionTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/CollectionTypeResolver.java similarity index 78% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/CollectionTypeResolver.java index 89e6356..f08cc10 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/CollectionTypeResolver.java @@ -1,10 +1,10 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -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.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.helper.TypeParameterHelper; +import com.kim.apidoc.core.common.description.ArrayTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/DateTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/DateTypeResolver.java similarity index 83% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/DateTypeResolver.java index b163b84..9c9f20d 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/DateTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.description.StringTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/EnumTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/EnumTypeResolver.java similarity index 84% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/EnumTypeResolver.java index 6138033..306f27c 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/EnumTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.StringTypeDescription; -import kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.description.StringTypeDescription; +import com.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/kim/apidoc/core/resolver/MapTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/MapTypeResolver.java similarity index 84% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/MapTypeResolver.java index 9cba7e1..8118dab 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/MapTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.description.UnAvailableTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/ObjectTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ObjectTypeResolver.java similarity index 92% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ObjectTypeResolver.java index b9302f9..cee038c 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ObjectTypeResolver.java @@ -1,12 +1,12 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; 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 com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.description.ObjectTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.helper.*; import java.util.Optional; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/PrimitiveTypeResolver.java similarity index 86% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/PrimitiveTypeResolver.java index cdd456b..36e4123 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/PrimitiveTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.PrimitiveTypeDescription; -import kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.description.PrimitiveTypeDescription; +import com.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/kim/apidoc/core/resolver/StringTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/StringTypeResolver.java similarity index 81% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/StringTypeResolver.java index b2942c4..2954444 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/StringTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.description.StringTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/SystemObjectTypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/SystemObjectTypeResolver.java similarity index 79% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/SystemObjectTypeResolver.java index 5fe5e56..da8ffb3 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/SystemObjectTypeResolver.java @@ -1,7 +1,7 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.description.UnAvailableTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.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/kim/apidoc/core/resolver/TypeNameResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeNameResolver.java similarity index 61% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeNameResolver.java index 7a12503..92efd8e 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeNameResolver.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.ast.type.Type; public interface TypeNameResolver { diff --git a/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolver.java similarity index 64% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolver.java index 469a691..3d9a3c7 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolver.java @@ -1,6 +1,6 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; import com.github.javaparser.resolution.types.ResolvedType; public interface TypeResolver { diff --git a/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolvers.java similarity index 91% rename from apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolvers.java index fc8a6b1..bc220d9 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolvers.java @@ -1,8 +1,8 @@ -package kim.apidoc.core.resolver; +package com.kim.apidoc.core.resolver; -import kim.apidoc.core.common.description.TypeDescription; -import kim.apidoc.core.common.helper.TypeNameHelper; -import kim.apidoc.core.common.description.UnAvailableTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.helper.TypeNameHelper; +import com.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/kim/apidoc/core/schema/Book.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Book.java similarity index 93% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Book.java index 99b9edd..dfd2da2 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Book.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Chapter.java similarity index 91% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Chapter.java index 59e699d..e65bda3 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Chapter.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Header.java similarity index 97% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Header.java index 962f0f2..cd99d64 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Header.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Method.java similarity index 96% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Method.java index 4cf18f6..31c09d7 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Method.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.extern.slf4j.Slf4j; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Node.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Node.java index 0abf6c1..d887a0b 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Node.java @@ -1,8 +1,8 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; -import kim.apidoc.core.Context; -import kim.apidoc.core.common.helper.CommentHelper; -import kim.apidoc.core.common.helper.StringHelper; +import com.kim.apidoc.core.Context; +import com.kim.apidoc.core.common.helper.CommentHelper; +import com.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/kim/apidoc/core/schema/Project.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Project.java similarity index 95% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Project.java index 6cbf3fb..656ce2b 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Project.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Row.java similarity index 94% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Row.java index b3ea98b..ed47a68 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Row.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.*; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Section.java similarity index 95% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Section.java index 7dcff54..7cd8918 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Section.java @@ -1,8 +1,8 @@ -package kim.apidoc.core.schema; +package com.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.kim.apidoc.core.common.ObjectMappers; +import com.kim.apidoc.core.common.QueryStringBuilder; +import com.kim.apidoc.core.common.helper.StringHelper; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; diff --git a/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Tag.java similarity index 95% rename from apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java rename to apidoc-core/src/main/java/com/kim/apidoc/core/schema/Tag.java index 753ae7c..899ed62 100644 --- a/apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java +++ b/apidoc-core/src/main/java/com/kim/apidoc/core/schema/Tag.java @@ -1,4 +1,4 @@ -package kim.apidoc.core.schema; +package com.kim.apidoc.core.schema; import lombok.Getter; import lombok.Setter; 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 deleted file mode 100644 index 739d24a..0000000 --- a/apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java +++ /dev/null @@ -1,18 +0,0 @@ -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/resources/templates/markdown.ftl b/apidoc-core/src/main/resources/templates/markdown.ftl new file mode 100644 index 0000000..0da6d53 --- /dev/null +++ b/apidoc-core/src/main/resources/templates/markdown.ftl @@ -0,0 +1,83 @@ +[TOC] + + + + +<#-- ---------- BEGIN 循环遍历book ----------> +<#if books??> + <#list books as bookKey,bookValue> + ${bookKey} + <#if bookValue.name??> +# ${bookValue.name} + + + <#list bookValue.chapters> + <#items as chapter> +## ${chapter?counter}. ${chapter.name} + +${chapter.description} + + <#list chapter.sections> + <#items as section> + ### ${chapter?counter}.${section?counter} ${section.name} + + ${section.description} + + **request** + + ```HTTP + POST /api/v1/users HTTP/1.1 + + { + "loginId":"admin", + "userName":"123456", + "passwords":"123456" + } + ``` + + **header** + + | Field | Type | Condition | Default | Description | + | :------- | :----- | :-------- | :------ | :---------- | + | loginId | String | | | 用户编号 | + | userName | String | | | 用户名 | + | password | String | | | 密码 | + + **query** + + | Field | Type | Condition | Default | Description | + | :------- | :----- | :-------- | :------ | :---------- | + <#list section.requestRows as rowKey,rowValue> + | rowValue.key | rowValue.type | rowValue.condition | rowValue.def | rowValue.remark | + + + **body** + + | Field | Type | Condition | Default | Description | + | :------- | :----- | :-------- | :------ | :---------- | + | loginId | String | | | 用户编号 | + | userName | String | | | 用户名 | + | password | String | | | 密码 | + + **response** + + ``` + { + "loginId":"admin", + "userName":"123456", + "passwords":"123456" + } + ``` + + | Field | Type | Description | + | :------- | :----- | :---------- | + | loginId | String | 用户编号 | + | userName | String | 用户名 | + | password | String | 密码 | + + + + + + +<#------------ END 循环遍历book ----------> diff --git a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java index ba0aa40..e1624c3 100644 --- a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java @@ -1,10 +1,10 @@ package com.kim.apidoc.springmvc; -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.kim.apidoc.core.common.URI; +import com.kim.apidoc.core.common.helper.AnnotationHelper; +import com.kim.apidoc.core.common.helper.ClassDeclarationHelper; +import com.kim.apidoc.core.common.helper.ExpressionHelper; +import com.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/kim/apidoc/springmvc/SpringMVCContext.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java index e178cdb..53b65a9 100644 --- a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java @@ -1,6 +1,6 @@ package com.kim.apidoc.springmvc; -import kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.ApiDoc; import com.google.common.collect.Lists; import lombok.Data; diff --git a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java index 091a26f..58a7e1a 100644 --- a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java @@ -1,18 +1,18 @@ 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.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.URI; +import com.kim.apidoc.core.common.description.ObjectTypeDescription; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.helper.AnnotationHelper; +import com.kim.apidoc.core.common.helper.ExpressionHelper; +import com.kim.apidoc.core.common.helper.StringHelper; +import com.kim.apidoc.core.parser.ParserStrategy; +import com.kim.apidoc.core.schema.Chapter; +import com.kim.apidoc.core.schema.Header; +import com.kim.apidoc.core.schema.Row; +import com.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; diff --git a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java index 7132860..6278094 100644 --- a/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java +++ b/apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java @@ -1,11 +1,11 @@ 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.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.common.description.TypeDescription; +import com.kim.apidoc.core.common.description.UnAvailableTypeDescription; +import com.kim.apidoc.core.common.helper.TypeParameterHelper; +import com.kim.apidoc.core.resolver.TypeNameResolver; +import com.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/kim.apidoc.core.parser.ParserStrategy b/apidoc-springmvc/src/main/resources/META-INF/services/com.kim.apidoc.core.parser.ParserStrategy similarity index 100% rename from apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy rename to apidoc-springmvc/src/main/resources/META-INF/services/com.kim.apidoc.core.parser.ParserStrategy diff --git a/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java index 7684aa0..f9046ea 100644 --- a/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java @@ -1,8 +1,8 @@ package com.kim.apidoc.example; -import kim.apidoc.core.ApiDoc; -import kim.apidoc.core.Context; +import com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.Context; import org.junit.Test; import java.nio.file.Paths; diff --git a/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java index f372c1d..23b6e0d 100644 --- a/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java +++ b/apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java @@ -1,8 +1,8 @@ package com.kim.apidoc.springmvc; -import kim.apidoc.core.ApiDoc; -import kim.apidoc.core.Context; -import kim.apidoc.core.common.diff.FileMatcher; +import com.kim.apidoc.core.ApiDoc; +import com.kim.apidoc.core.Context; +import com.kim.apidoc.core.common.diff.FileMatcher; import org.junit.Test; import java.io.IOException; 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 a596775..6bc9502 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" @@ -2,6 +2,10 @@ + + +# 系统管理 + ## 1. 用户接口 与用户相关接口。 @@ -10,7 +14,7 @@ 添加用户 -#### request + **request** ```HTTP POST /api/v1/users HTTP/1.1 @@ -22,7 +26,7 @@ POST /api/v1/users HTTP/1.1 } ``` -##### header + **header** | Field | Type | Condition | Default | Description | | :------- | :----- | :-------- | :------ | :---------- | @@ -30,7 +34,7 @@ POST /api/v1/users HTTP/1.1 | userName | String | | | 用户名 | | password | String | | | 密码 | -##### query + **query** | Field | Type | Condition | Default | Description | | :------- | :----- | :-------- | :------ | :---------- | @@ -38,7 +42,7 @@ POST /api/v1/users HTTP/1.1 | userName | String | | | 用户名 | | password | String | | | 密码 | -##### body + **body** | Field | Type | Condition | Default | Description | | :------- | :----- | :-------- | :------ | :---------- | @@ -46,7 +50,7 @@ POST /api/v1/users HTTP/1.1 | userName | String | | | 用户名 | | password | String | | | 密码 | -#### response + **response** ``` { -- GitLab