Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apidoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
apidoc
Commits
2e5785bf
Commit
2e5785bf
authored
Mar 27, 2020
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
♻
Refactoring code.
parent
80acc032
Changes
84
Hide whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
390 additions
and
231 deletions
+390
-231
apidoc-core/build.gradle
apidoc-core/build.gradle
+1
-0
apidoc-core/src/main/java/com/kim/apidoc/core/ApiDoc.java
apidoc-core/src/main/java/com/kim/apidoc/core/ApiDoc.java
+11
-11
apidoc-core/src/main/java/com/kim/apidoc/core/Context.java
apidoc-core/src/main/java/com/kim/apidoc/core/Context.java
+23
-13
apidoc-core/src/main/java/com/kim/apidoc/core/common/Assert.java
...core/src/main/java/com/kim/apidoc/core/common/Assert.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java
...e/src/main/java/com/kim/apidoc/core/common/Constants.java
+19
-0
apidoc-core/src/main/java/com/kim/apidoc/core/common/ObjectMappers.java
...c/main/java/com/kim/apidoc/core/common/ObjectMappers.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/QueryStringBuilder.java
...n/java/com/kim/apidoc/core/common/QueryStringBuilder.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/URI.java
...oc-core/src/main/java/com/kim/apidoc/core/common/URI.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ArrayTypeDescription.java
.../apidoc/core/common/description/ArrayTypeDescription.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/ObjectTypeDescription.java
...apidoc/core/common/description/ObjectTypeDescription.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/PrimitiveTypeDescription.java
...doc/core/common/description/PrimitiveTypeDescription.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/StringTypeDescription.java
...apidoc/core/common/description/StringTypeDescription.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/TypeDescription.java
...m/kim/apidoc/core/common/description/TypeDescription.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/description/UnAvailableTypeDescription.java
...c/core/common/description/UnAvailableTypeDescription.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileMatcher.java
...ain/java/com/kim/apidoc/core/common/diff/FileMatcher.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/FileSystem.java
...main/java/com/kim/apidoc/core/common/diff/FileSystem.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/diff/MatchPatcher.java
...in/java/com/kim/apidoc/core/common/diff/MatchPatcher.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/AnnotationHelper.java
...a/com/kim/apidoc/core/common/helper/AnnotationHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ClassDeclarationHelper.java
...kim/apidoc/core/common/helper/ClassDeclarationHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CommentHelper.java
...java/com/kim/apidoc/core/common/helper/CommentHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/CompilationUnitHelper.java
.../kim/apidoc/core/common/helper/CompilationUnitHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ExpressionHelper.java
...a/com/kim/apidoc/core/common/helper/ExpressionHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FieldHelper.java
...n/java/com/kim/apidoc/core/common/helper/FieldHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/FileHelper.java
...in/java/com/kim/apidoc/core/common/helper/FileHelper.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/JsonPropertyHelper.java
...com/kim/apidoc/core/common/helper/JsonPropertyHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/OptionalHelper.java
...ava/com/kim/apidoc/core/common/helper/OptionalHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ReferenceContext.java
...a/com/kim/apidoc/core/common/helper/ReferenceContext.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/StringHelper.java
.../java/com/kim/apidoc/core/common/helper/StringHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeNameHelper.java
...ava/com/kim/apidoc/core/common/helper/TypeNameHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/TypeParameterHelper.java
...om/kim/apidoc/core/common/helper/TypeParameterHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/helper/ValidationHelper.java
...a/com/kim/apidoc/core/common/helper/ValidationHelper.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/MarkupBuilder.java
...java/com/kim/apidoc/core/common/markup/MarkupBuilder.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java
.../com/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java
...m/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/asciidoc/Color.java
...ava/com/kim/apidoc/core/common/markup/asciidoc/Color.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/Markdown.java
.../com/kim/apidoc/core/common/markup/markdown/Markdown.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java
...m/apidoc/core/common/markup/markdown/MarkdownBuilder.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Body.java
...rc/main/java/com/kim/apidoc/core/common/postman/Body.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/BodyMode.java
...ain/java/com/kim/apidoc/core/common/postman/BodyMode.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Folder.java
.../main/java/com/kim/apidoc/core/common/postman/Folder.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Info.java
...rc/main/java/com/kim/apidoc/core/common/postman/Info.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Item.java
...rc/main/java/com/kim/apidoc/core/common/postman/Item.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Parameter.java
...in/java/com/kim/apidoc/core/common/postman/Parameter.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Postman.java
...main/java/com/kim/apidoc/core/common/postman/Postman.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Request.java
...main/java/com/kim/apidoc/core/common/postman/Request.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Response.java
...ain/java/com/kim/apidoc/core/common/postman/Response.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/common/postman/Url.java
...src/main/java/com/kim/apidoc/core/common/postman/Url.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/parser/ParserStrategy.java
.../main/java/com/kim/apidoc/core/parser/ParserStrategy.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/parser/VisitorParser.java
...c/main/java/com/kim/apidoc/core/parser/VisitorParser.java
+6
-6
apidoc-core/src/main/java/com/kim/apidoc/core/render/AsciiDocRender.java
.../main/java/com/kim/apidoc/core/render/AsciiDocRender.java
+11
-11
apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java
.../main/java/com/kim/apidoc/core/render/MarkdownRender.java
+60
-0
apidoc-core/src/main/java/com/kim/apidoc/core/render/PostmanRender.java
...c/main/java/com/kim/apidoc/core/render/PostmanRender.java
+15
-15
apidoc-core/src/main/java/com/kim/apidoc/core/render/ProjectRender.java
...c/main/java/com/kim/apidoc/core/render/ProjectRender.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ArrayTypeResolver.java
.../java/com/kim/apidoc/core/resolver/ArrayTypeResolver.java
+4
-4
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/CollectionTypeResolver.java
.../com/kim/apidoc/core/resolver/CollectionTypeResolver.java
+6
-6
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/DateTypeResolver.java
...n/java/com/kim/apidoc/core/resolver/DateTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/EnumTypeResolver.java
...n/java/com/kim/apidoc/core/resolver/EnumTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/MapTypeResolver.java
...in/java/com/kim/apidoc/core/resolver/MapTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/ObjectTypeResolver.java
...java/com/kim/apidoc/core/resolver/ObjectTypeResolver.java
+5
-5
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/PrimitiveTypeResolver.java
...a/com/kim/apidoc/core/resolver/PrimitiveTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/StringTypeResolver.java
...java/com/kim/apidoc/core/resolver/StringTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/SystemObjectTypeResolver.java
...om/kim/apidoc/core/resolver/SystemObjectTypeResolver.java
+3
-3
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeNameResolver.java
...n/java/com/kim/apidoc/core/resolver/TypeNameResolver.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolver.java
.../main/java/com/kim/apidoc/core/resolver/TypeResolver.java
+2
-2
apidoc-core/src/main/java/com/kim/apidoc/core/resolver/TypeResolvers.java
...main/java/com/kim/apidoc/core/resolver/TypeResolvers.java
+4
-4
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Book.java
...c-core/src/main/java/com/kim/apidoc/core/schema/Book.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Chapter.java
...ore/src/main/java/com/kim/apidoc/core/schema/Chapter.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Header.java
...core/src/main/java/com/kim/apidoc/core/schema/Header.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Method.java
...core/src/main/java/com/kim/apidoc/core/schema/Method.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Node.java
...c-core/src/main/java/com/kim/apidoc/core/schema/Node.java
+4
-4
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Project.java
...ore/src/main/java/com/kim/apidoc/core/schema/Project.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Row.java
...oc-core/src/main/java/com/kim/apidoc/core/schema/Row.java
+1
-1
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Section.java
...ore/src/main/java/com/kim/apidoc/core/schema/Section.java
+4
-4
apidoc-core/src/main/java/com/kim/apidoc/core/schema/Tag.java
...oc-core/src/main/java/com/kim/apidoc/core/schema/Tag.java
+1
-1
apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java
.../src/main/java/kim/apidoc/core/render/MarkdownRender.java
+0
-18
apidoc-core/src/main/resources/templates/markdown.ftl
apidoc-core/src/main/resources/templates/markdown.ftl
+83
-0
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java
...n/java/com/kim/apidoc/springmvc/RequestMappingHelper.java
+5
-5
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java
.../main/java/com/kim/apidoc/springmvc/SpringMVCContext.java
+1
-1
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java
.../src/main/java/com/kim/apidoc/springmvc/SpringParser.java
+12
-12
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java
...pidoc/springmvc/resovler/SpringComponentTypeResolver.java
+6
-6
apidoc-springmvc/src/main/resources/META-INF/services/com.kim.apidoc.core.parser.ParserStrategy
...TA-INF/services/com.kim.apidoc.core.parser.ParserStrategy
+0
-0
apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java
...gmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java
+2
-2
apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java
...vc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java
+3
-3
markdown接口模版.md
markdown接口模版.md
+9
-5
No files found.
apidoc-core/build.gradle
View file @
2e5785bf
...
...
@@ -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'
}
apidoc-core/src/main/java/kim/apidoc/core/ApiDoc.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/ApiDoc.java
View file @
2e5785bf
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
()
);
}
/**
...
...
apidoc-core/src/main/java/kim/apidoc/core/Context.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/Context.java
View file @
2e5785bf
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
p
ublic
String
framework
;
p
rivate
String
framework
;
/**
* The Renders.
*/
@Setter
p
ublic
List
<
ProjectRender
>
renders
=
Lists
.
newArrayList
(
p
rivate
List
<
ProjectRender
>
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
<
String
,
Object
>
ext
=
Maps
.
newHashMap
();
private
Map
<
String
,
Object
>
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
);
}
}
apidoc-core/src/main/java/kim/apidoc/core/common/Assert.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/Assert.java
View file @
2e5785bf
package
kim.apidoc.core.common
;
package
com.
kim.apidoc.core.common
;
import
com.google.common.base.Strings
;
...
...
apidoc-core/src/main/java/com/kim/apidoc/core/common/Constants.java
0 → 100644
View file @
2e5785bf
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"
;
}
apidoc-core/src/main/java/kim/apidoc/core/common/ObjectMappers.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/ObjectMappers.java
View file @
2e5785bf
package
kim.apidoc.core.common
;
package
com.
kim.apidoc.core.common
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/QueryStringBuilder.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/QueryStringBuilder.java
View file @
2e5785bf
package
kim.apidoc.core.common
;
package
com.
kim.apidoc.core.common
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/URI.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/URI.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/ArrayTypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/ArrayTypeDescription.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/ObjectTypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/ObjectTypeDescription.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/PrimitiveTypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/PrimitiveTypeDescription.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/StringTypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/StringTypeDescription.java
View file @
2e5785bf
package
kim.apidoc.core.common.description
;
package
com.
kim.apidoc.core.common.description
;
public
class
StringTypeDescription
extends
TypeDescription
{
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/TypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/TypeDescription.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/description/UnAvailableTypeDescription.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/description/UnAvailableTypeDescription.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileMatcher.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/diff/FileMatcher.java
View file @
2e5785bf
package
kim.apidoc.core.common.diff
;
package
com.
kim.apidoc.core.common.diff
;
import
com.google.common.base.Charsets
;
import
lombok.Getter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/diff/FileSystem.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/diff/FileSystem.java
View file @
2e5785bf
package
kim.apidoc.core.common.diff
;
package
com.
kim.apidoc.core.common.diff
;
import
java.awt.*
;
import
java.io.File
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/diff/MatchPatcher.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/diff/MatchPatcher.java
View file @
2e5785bf
...
...
@@ -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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/AnnotationHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/AnnotationHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/ClassDeclarationHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/ClassDeclarationHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/CommentHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/CommentHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/CompilationUnitHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/CompilationUnitHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/ExpressionHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/ExpressionHelper.java
View file @
2e5785bf
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.*
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/FieldHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/FieldHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/FileHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/FileHelper.java
View file @
2e5785bf
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
<
Path
>
find
(
Path
start
,
String
structure
){
public
static
List
<
Path
>
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
());
}
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/JsonPropertyHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/JsonPropertyHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/OptionalHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/OptionalHelper.java
View file @
2e5785bf
package
kim.apidoc.core.common.helper
;
package
com.
kim.apidoc.core.common.helper
;
import
java.util.Optional
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/ReferenceContext.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/ReferenceContext.java
View file @
2e5785bf
package
kim.apidoc.core.common.helper
;
package
com.
kim.apidoc.core.common.helper
;
import
com.google.common.collect.Sets
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/StringHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/StringHelper.java
View file @
2e5785bf
package
kim.apidoc.core.common.helper
;
package
com.
kim.apidoc.core.common.helper
;
import
com.google.common.base.Strings
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeNameHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/TypeNameHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/TypeParameterHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/TypeParameterHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/helper/ValidationHelper.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/helper/ValidationHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/MarkupBuilder.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/MarkupBuilder.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/asciidoc/AsciiDoc.java
View file @
2e5785bf
package
kim.apidoc.core.common.markup.asciidoc
;
package
com.
kim.apidoc.core.common.markup.asciidoc
;
public
enum
AsciiDoc
implements
CharSequence
{
EXTENSION
(
".adoc"
),
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/asciidoc/AsciiDocBuilder.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/asciidoc/Color.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/asciidoc/Color.java
View file @
2e5785bf
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
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/Markdown.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/markdown/Markdown.java
View file @
2e5785bf
package
kim.apidoc.core.common.markup.markdown
;
package
com.
kim.apidoc.core.common.markup.markdown
;
public
enum
Markdown
implements
CharSequence
{
EXTENSION
(
".md"
),
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/markup/markdown/MarkdownBuilder.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Body.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Body.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/BodyMode.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/BodyMode.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
/**
* 对应postman定义的mode
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Folder.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Folder.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Getter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Info.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Info.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Item.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Item.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Parameter.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Parameter.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Postman.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Postman.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Request.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Request.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Response.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Response.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/common/postman/Url.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/common/postman/Url.java
View file @
2e5785bf
package
kim.apidoc.core.common.postman
;
package
com.
kim.apidoc.core.common.postman
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/parser/ParserStrategy.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/parser/ParserStrategy.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/parser/VisitorParser.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/parser/VisitorParser.java
View file @
2e5785bf
package
kim.apidoc.core.parser
;
package
com.
kim.apidoc.core.parser
;
import
kim.apidoc.core.common.helper.OptionalHelp
er
;
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.Chapt
er
;
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/render/AsciiDocRender.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/render/AsciiDocRender.java
View file @
2e5785bf
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"
);
...
...
apidoc-core/src/main/java/com/kim/apidoc/core/render/MarkdownRender.java
0 → 100644
View file @
2e5785bf
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
);
}
}
apidoc-core/src/main/java/kim/apidoc/core/render/PostmanRender.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/render/PostmanRender.java
View file @
2e5785bf
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
());
}
...
...
apidoc-core/src/main/java/kim/apidoc/core/render/ProjectRender.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/render/ProjectRender.java
View file @
2e5785bf
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.
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/ArrayTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/ArrayTypeResolver.java
View file @
2e5785bf
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
{
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/CollectionTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/CollectionTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/DateTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/DateTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/EnumTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/EnumTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/MapTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/MapTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/ObjectTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/ObjectTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/PrimitiveTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/PrimitiveTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/StringTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/StringTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/SystemObjectTypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/SystemObjectTypeResolver.java
View file @
2e5785bf
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
{
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeNameResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/TypeNameResolver.java
View file @
2e5785bf
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
{
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolver.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/TypeResolver.java
View file @
2e5785bf
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
{
...
...
apidoc-core/src/main/java/kim/apidoc/core/resolver/TypeResolvers.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/resolver/TypeResolvers.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Book.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Book.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Chapter.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Chapter.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Header.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Header.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Method.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Method.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.extern.slf4j.Slf4j
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Node.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Node.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Project.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Project.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Row.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Row.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.*
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Section.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Section.java
View file @
2e5785bf
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
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/schema/Tag.java
→
apidoc-core/src/main/java/
com/
kim/apidoc/core/schema/Tag.java
View file @
2e5785bf
package
kim.apidoc.core.schema
;
package
com.
kim.apidoc.core.schema
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
apidoc-core/src/main/java/kim/apidoc/core/render/MarkdownRender.java
deleted
100644 → 0
View file @
80acc032
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
)
{
}
}
apidoc-core/src/main/resources/templates/markdown.ftl
0 → 100644
View file @
2e5785bf
[TOC]
<#-- ---------- BEGIN 循环遍历book ---------->
<#if books??>
<#list books as bookKey,bookValue>
${bookKey}
<#if bookValue.name??>
# ${bookValue.name}
</#if>
<#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 |
</#list>
**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 | 密码 |
</#items>
</#list>
</#items>
</#list>
</#list>
</#if>
<#------------ END 循环遍历book ---------->
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/RequestMappingHelper.java
View file @
2e5785bf
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
;
...
...
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringMVCContext.java
View file @
2e5785bf
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
;
...
...
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/SpringParser.java
View file @
2e5785bf
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
;
...
...
apidoc-springmvc/src/main/java/com/kim/apidoc/springmvc/resovler/SpringComponentTypeResolver.java
View file @
2e5785bf
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
;
...
...
apidoc-springmvc/src/main/resources/META-INF/services/kim.apidoc.core.parser.ParserStrategy
→
apidoc-springmvc/src/main/resources/META-INF/services/
com.
kim.apidoc.core.parser.ParserStrategy
View file @
2e5785bf
File moved
apidoc-springmvc/src/test/java/com/kim/apidoc/example/ApigccTest.java
View file @
2e5785bf
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
;
...
...
apidoc-springmvc/src/test/java/com/kim/apidoc/springmvc/SpringTest.java
View file @
2e5785bf
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
;
...
...
markdown接口模版.md
View file @
2e5785bf
...
...
@@ -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**
```
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment