Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3456b37

Browse files
committed
add yapi
1 parent cd2d5f6 commit 3456b37

File tree

5 files changed

+76
-4
lines changed

5 files changed

+76
-4
lines changed

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
.gradle
44
gradle/
55
out/
6-
src/static/api/
6+
src/static/api/
7+
build/
8+
spring-api-demo/build/

‎build.gradle‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,23 @@ repositories {
1212
mavenCentral()
1313
}
1414

15+
16+
jar {
17+
manifestContentCharset 'utf-8'
18+
metadataCharset 'utf-8'
19+
manifest {
20+
attributes "Main-Class": "com.hsjfans.github.Booter.main"
21+
}
22+
from {
23+
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
24+
}
25+
}
26+
1527
dependencies {
1628
testCompile group: 'junit', name: 'junit', version: '4.12'
1729
compile 'com.google.guava:guava:27.1-jre'
1830
compileOnly "org.projectlombok:lombok:1.16.16"
31+
annotationProcessor "org.projectlombok:lombok:1.16.16"
1932
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.14.4-SNAPSHOT'
2033
// https://mvnrepository.com/artifact/org.springframework/spring-webmvc
2134
compile group: 'org.springframework', name: 'spring-webmvc', version: '5.1.3.RELEASE'

‎src/main/java/com/hsjfans/github/Booter.java‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,27 @@
1616
*/
1717
public class Booter {
1818

19+
// public static void main(String[] args) throws ParserException {
20+
//
21+
// String realPath = "/Volumes/doc/projects/java/api";
22+
// Config config = new Config();
23+
// config.setPackageName(realPath);
24+
// config.setDocName("接口文档");
25+
// config.setApiName("api");
26+
// Parser parser = new SpringParser(config);
27+
// ApiTree apiTree = parser.parse(config.getPackageName(),true);
28+
// Generator generator = new HtmlGenerator();
29+
// generator.from(apiTree,config);
30+
//
31+
// }
1932

2033
public static void main(String[] args) throws ParserException {
2134

22-
String realPath = "/Volumes/doc/projects/java/api";
35+
String realPath = args[0];
2336
Config config = new Config();
2437
config.setPackageName(realPath);
25-
config.setDocName("接口文档");
26-
config.setApiName("api");
38+
config.setDocName(args[1]);
39+
config.setApiName(args[2]);
2740
Parser parser = new SpringParser(config);
2841
ApiTree apiTree = parser.parse(config.getPackageName(),true);
2942
Generator generator = new HtmlGenerator();
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.hsjfans.github.generator;
2+
3+
import com.hsjfans.github.config.Config;
4+
import com.hsjfans.github.model.ApiTree;
5+
import com.hsjfans.github.model.ControllerClass;
6+
import com.hsjfans.github.model.ControllerMethod;
7+
8+
/**
9+
*
10+
* yapi Json 生成
11+
*
12+
* @author hsjfans[hsjfans.scholar@gmail.com]
13+
*/
14+
public class YApiJsonGenerator extends AbstractGenerator {
15+
16+
@Override
17+
protected void buildControllerDoc(ControllerClass controllerClass) {
18+
19+
}
20+
21+
@Override
22+
protected void buildApiDoc(ControllerClass controllerClass, ControllerMethod controllerMethod) {
23+
24+
}
25+
26+
@Override
27+
protected void buildExtraDoc() {
28+
29+
}
30+
31+
@Override
32+
public void from(ApiTree apiTree, Config config) {
33+
34+
}
35+
}

‎src/main/java/com/hsjfans/github/parser/Parser.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,14 @@ public interface Parser {
4040
ApiTree parse(List<String> projectPaths,boolean recursive) throws ParserException;
4141

4242

43+
// /**
44+
// *
45+
// * @param file xxx.java
46+
// * @return apiTree
47+
// * @throws ParserException
48+
// */
49+
// ApiTree parse(String file) throws ParserException;
50+
51+
4352

4453
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /