Commit ca53f41f authored by duanledexianxianxian's avatar duanledexianxianxian 😁

代码重构

parent d1cdf8f4
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;
package com.github.fengyuchenglun.apidoc.core;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.github.fengyuchenglun.apidoc.core.parser.ParserStrategy;
import com.github.fengyuchenglun.apidoc.core.parser.VisitorParser;
import com.github.fengyuchenglun.apidoc.core.render.ProjectRender;
import com.github.fengyuchenglun.apidoc.core.resolver.TypeResolvers;
import com.github.fengyuchenglun.apidoc.core.schema.Project;
import com.github.javaparser.ParseResult;
import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.ast.CompilationUnit;
......
package com.kim.apidoc.core;
package com.github.fengyuchenglun.apidoc.core;
import com.github.fengyuchenglun.apidoc.core.common.Constants;
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.MarkdownRender;
import com.kim.apidoc.core.render.ProjectRender;
import com.github.fengyuchenglun.apidoc.core.common.helper.FileHelper;
import com.github.fengyuchenglun.apidoc.core.render.MarkdownRender;
import com.github.fengyuchenglun.apidoc.core.render.ProjectRender;
import lombok.Getter;
import lombok.Setter;
......@@ -13,8 +14,6 @@ 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.
*
......@@ -109,7 +108,7 @@ public class Context {
* markdown模版文件路径
*/
@Setter
private String markdownTemplate = MARKDOWN_TEMPLATE;
private String markdownTemplate = Constants.MARKDOWN_TEMPLATE;
/**
* 自定义扩展参数
......
package com.kim.apidoc.core.common;
package com.github.fengyuchenglun.apidoc.core.common;
import com.google.common.base.Strings;
......
package com.kim.apidoc.core.common;
package com.github.fengyuchenglun.apidoc.core.common;
import java.nio.charset.StandardCharsets;
......
package com.kim.apidoc.core.common;
package com.github.fengyuchenglun.apidoc.core.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
......
package com.kim.apidoc.core.common;
package com.github.fengyuchenglun.apidoc.core.common;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
......
package com.kim.apidoc.core.common;
package com.github.fengyuchenglun.apidoc.core.common;
import com.kim.apidoc.core.common.helper.StringHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.google.common.collect.Lists;
import lombok.EqualsAndHashCode;
import lombok.Getter;
......
package com.kim.apidoc.core.common.description;
package com.github.fengyuchenglun.apidoc.core.common.description;
import com.kim.apidoc.core.schema.Row;
import com.kim.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import com.fasterxml.jackson.databind.node.ArrayNode;
import java.util.ArrayList;
......
package com.kim.apidoc.core.common.description;
package com.github.fengyuchenglun.apidoc.core.common.description;
import com.kim.apidoc.core.schema.Row;
import com.kim.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
import lombok.Getter;
......
package com.kim.apidoc.core.common.description;
package com.github.fengyuchenglun.apidoc.core.common.description;
import com.github.javaparser.resolution.types.ResolvedPrimitiveType;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
......
package com.kim.apidoc.core.common.description;
package com.github.fengyuchenglun.apidoc.core.common.description;
import com.github.fengyuchenglun.apidoc.core.common.helper.CommentHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import com.github.javaparser.ast.comments.Comment;
import com.github.javaparser.javadoc.Javadoc;
import com.google.common.collect.Lists;
import com.kim.apidoc.core.common.helper.CommentHelper;
import com.kim.apidoc.core.common.helper.StringHelper;
import com.kim.apidoc.core.schema.Row;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.description;
package com.github.fengyuchenglun.apidoc.core.common.description;
import com.kim.apidoc.core.schema.Row;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import java.util.Collection;
......
package com.kim.apidoc.core.common.diff;
package com.github.fengyuchenglun.apidoc.core.common.diff;
import com.google.common.base.Charsets;
import lombok.Getter;
......
package com.kim.apidoc.core.common.diff;
package com.github.fengyuchenglun.apidoc.core.common.diff;
import java.awt.*;
import java.io.File;
......
......@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kim.apidoc.core.common.diff;
package com.github.fengyuchenglun.apidoc.core.common.diff;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.fengyuchenglun.apidoc.core.schema.Cell;
import com.github.javaparser.ast.body.EnumConstantDeclaration;
import com.github.javaparser.ast.body.EnumDeclaration;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.resolution.declarations.ResolvedEnumConstantDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedEnumDeclaration;
import com.kim.apidoc.core.schema.Cell;
import java.util.ArrayList;
import java.util.List;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.expr.*;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.fengyuchenglun.apidoc.core.schema.Cell;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.VariableDeclarator;
import com.github.javaparser.ast.comments.Comment;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserFieldDeclaration;
import com.kim.apidoc.core.schema.Cell;
import java.util.ArrayList;
import java.util.List;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.expr.AnnotationExpr;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import java.util.Optional;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.google.common.collect.Sets;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.google.common.base.Strings;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.ImportDeclaration;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
......
package com.kim.apidoc.core.common.helper;
package com.github.fengyuchenglun.apidoc.core.common.helper;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.expr.AnnotationExpr;
......
package com.kim.apidoc.core.common.markup;
package com.github.fengyuchenglun.apidoc.core.common.markup;
import com.kim.apidoc.core.common.markup.asciidoc.AsciiDocBuilder;
import com.github.fengyuchenglun.apidoc.core.common.markup.asciidoc.AsciiDocBuilder;
import java.util.List;
import java.util.function.Consumer;
......
package com.kim.apidoc.core.common.markup.asciidoc;
package com.github.fengyuchenglun.apidoc.core.common.markup.asciidoc;
public enum AsciiDoc implements CharSequence {
EXTENSION(".adoc"),
......
package com.kim.apidoc.core.common.markup.asciidoc;
package com.github.fengyuchenglun.apidoc.core.common.markup.asciidoc;
import com.kim.apidoc.core.common.markup.MarkupBuilder;
import com.kim.apidoc.core.common.Assert;
import com.github.fengyuchenglun.apidoc.core.common.Assert;
import com.github.fengyuchenglun.apidoc.core.common.markup.MarkupBuilder;
import com.google.common.base.Strings;
import java.util.List;
......
package com.kim.apidoc.core.common.markup.asciidoc;
package com.github.fengyuchenglun.apidoc.core.common.markup.asciidoc;
/**
* https://en.wikipedia.org/wiki/Web_colors#HTML_color_names
......
package com.kim.apidoc.core.common.markup.markdown;
package com.github.fengyuchenglun.apidoc.core.common.markup.markdown;
public enum Markdown implements CharSequence {
EXTENSION(".md"),
......
package com.kim.apidoc.core.common.markup.markdown;
package com.github.fengyuchenglun.apidoc.core.common.markup.markdown;
import com.kim.apidoc.core.common.markup.MarkupBuilder;
import com.kim.apidoc.core.common.Assert;
import com.github.fengyuchenglun.apidoc.core.common.Assert;
import com.github.fengyuchenglun.apidoc.core.common.markup.MarkupBuilder;
import com.google.common.base.Strings;
import java.util.List;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
/**
* 对应postman定义的mode
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import com.kim.apidoc.core.schema.Row;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import com.kim.apidoc.core.schema.Header;
import com.kim.apidoc.core.schema.Method;
import com.github.fengyuchenglun.apidoc.core.schema.Header;
import com.github.fengyuchenglun.apidoc.core.schema.Method;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import com.kim.apidoc.core.schema.Header;
import com.github.fengyuchenglun.apidoc.core.schema.Header;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.common.postman;
package com.github.fengyuchenglun.apidoc.core.common.postman;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.parser;
package com.github.fengyuchenglun.apidoc.core.parser;
import com.kim.apidoc.core.schema.Chapter;
import com.kim.apidoc.core.schema.Section;
import com.github.fengyuchenglun.apidoc.core.schema.Chapter;
import com.github.fengyuchenglun.apidoc.core.schema.Section;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
......
package com.kim.apidoc.core.parser;
package com.github.fengyuchenglun.apidoc.core.parser;
import com.github.fengyuchenglun.apidoc.core.schema.*;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.EnumDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import com.kim.apidoc.core.ApiDoc;
import com.kim.apidoc.core.common.helper.OptionalHelper;
import com.kim.apidoc.core.schema.*;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.helper.OptionalHelper;
/**
......
package com.kim.apidoc.core.render;
package com.github.fengyuchenglun.apidoc.core.render;
import com.github.fengyuchenglun.apidoc.core.schema.*;
import com.google.common.collect.Lists;
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 com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.helper.FileHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.github.fengyuchenglun.apidoc.core.common.markup.MarkupBuilder;
import com.github.fengyuchenglun.apidoc.core.common.markup.asciidoc.AsciiDoc;
import lombok.extern.slf4j.Slf4j;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.AttributesBuilder;
......
package com.kim.apidoc.core.render;
package com.github.fengyuchenglun.apidoc.core.render;
import com.kim.apidoc.core.ApiDoc;
import com.kim.apidoc.core.common.Constants;
import com.kim.apidoc.core.common.ObjectMappers;
import com.kim.apidoc.core.common.helper.FileHelper;
import com.kim.apidoc.core.schema.Project;
import com.github.fengyuchenglun.apidoc.core.common.Constants;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.helper.FileHelper;
import com.github.fengyuchenglun.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.io.StringWriter;
import java.nio.file.Path;
......
package com.kim.apidoc.core.render;
package com.github.fengyuchenglun.apidoc.core.render;
import com.fasterxml.jackson.databind.node.ObjectNode;
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 com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.common.postman.*;
import com.github.fengyuchenglun.apidoc.core.schema.*;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.helper.FileHelper;
import lombok.extern.slf4j.Slf4j;
import java.nio.file.Path;
......
package com.kim.apidoc.core.render;
package com.github.fengyuchenglun.apidoc.core.render;
import com.kim.apidoc.core.schema.Project;
import com.github.fengyuchenglun.apidoc.core.schema.Project;
/**
* The interface Project render.
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
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.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.ArrayTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
public class ArrayTypeResolver implements TypeResolver {
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
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.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.helper.TypeParameterHelper;
import com.github.fengyuchenglun.apidoc.core.common.description.ArrayTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
import com.google.common.collect.ImmutableList;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.kim.apidoc.core.common.description.StringTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.StringTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
import com.google.common.collect.ImmutableList;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.StringTypeDescription;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.StringTypeDescription;
import com.github.fengyuchenglun.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;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.kim.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
import com.google.common.collect.ImmutableList;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.github.fengyuchenglun.apidoc.core.common.helper.*;
import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import com.github.javaparser.resolution.types.ResolvedType;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
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 com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.description.ObjectTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import java.util.Optional;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.PrimitiveTypeDescription;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.PrimitiveTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
import com.google.common.collect.ImmutableList;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.kim.apidoc.core.common.description.StringTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.StringTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
import com.google.common.collect.ImmutableList;
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.kim.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
public class SystemObjectTypeResolver implements TypeResolver {
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.javaparser.ast.type.Type;
public interface TypeNameResolver {
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
import com.kim.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.javaparser.resolution.types.ResolvedType;
public interface TypeResolver {
......
package com.kim.apidoc.core.resolver;
package com.github.fengyuchenglun.apidoc.core.resolver;
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.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.helper.TypeNameHelper;
import com.github.fengyuchenglun.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;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName;
import com.kim.apidoc.core.common.helper.EnumHelper;
import com.kim.apidoc.core.common.helper.FieldHelper;
import com.kim.apidoc.core.common.helper.FileHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.EnumHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.FieldHelper;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import com.google.common.collect.Lists;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.extern.slf4j.Slf4j;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import com.github.fengyuchenglun.apidoc.core.Context;
import com.github.javaparser.ast.comments.Comment;
import com.github.javaparser.javadoc.Javadoc;
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.fengyuchenglun.apidoc.core.common.helper.CommentHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import lombok.Getter;
......
package com.github.fengyuchenglun.apidoc.core.schema;
/**
* 请求参数枚举类型
*
* @author duanledexianxianxian
* @date 2020 /3/29 0:37
* @since 1.0.0
*/
public enum RequestParameterType {
/**
* 查询参数.
*/
QUERY("QUERY", "查询参数"),
/**
* 路径参数.
*/
PATH("PATH", "路径参数"),
/**
* 请求参数体.
*/
BODY("BODY", "请求体");
/**
* 编码
*/
private String code;
/**
* 信息
*/
private String msg;
RequestParameterType(String code, String msg) {
this.code = code;
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.*;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import com.kim.apidoc.core.common.ObjectMappers;
import com.kim.apidoc.core.common.QueryStringBuilder;
import com.kim.apidoc.core.common.helper.StringHelper;
import com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
import com.github.fengyuchenglun.apidoc.core.common.QueryStringBuilder;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Getter;
......
package com.kim.apidoc.core.schema;
package com.github.fengyuchenglun.apidoc.core.schema;
import lombok.Getter;
import lombok.Setter;
......
package com.kim.apidoc.core.schema;
/**
* 请求参数枚举类型
*
* @author duanledexianxianxian
* @date 2020 /3/29 0:37
* @since 1.0.0
*/
public enum RequestParameterType {
/**
* 查询参数.
*/
QUERY,
/**
* 路径参数.
*/
PATH,
/**
* 请求参数体.
*/
BODY
}
[TOC]
<#-- ---------- BEGIN 循环遍历book ---------->
<#if books??>
<#list books as bookKey,bookValue>
......
package com.kim.apidoc.springmvc;
package com.github.fengyuchenglun.apidoc.springmvc;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.Parameter;
......
package com.kim.apidoc.springmvc;
package com.github.fengyuchenglun.apidoc.springmvc;
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.fengyuchenglun.apidoc.core.common.URI;
import com.github.fengyuchenglun.apidoc.core.common.helper.AnnotationHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.ClassDeclarationHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.ExpressionHelper;
import com.github.fengyuchenglun.apidoc.core.schema.Method;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
......
package com.kim.apidoc.springmvc;
package com.github.fengyuchenglun.apidoc.springmvc;
import com.kim.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.google.common.collect.Lists;
import lombok.Data;
......
package com.kim.apidoc.springmvc;
package com.github.fengyuchenglun.apidoc.springmvc;
import com.github.fengyuchenglun.apidoc.core.common.helper.AnnotationHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.ClassDeclarationHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.ExpressionHelper;
import com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
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.*;
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.kim.apidoc.springmvc.resovler.SpringComponentTypeResolver;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.URI;
import com.github.fengyuchenglun.apidoc.core.common.description.ObjectTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.parser.ParserStrategy;
import com.github.fengyuchenglun.apidoc.core.schema.Chapter;
import com.github.fengyuchenglun.apidoc.core.schema.Header;
import com.github.fengyuchenglun.apidoc.core.schema.Row;
import com.github.fengyuchenglun.apidoc.core.schema.Section;
import com.github.fengyuchenglun.apidoc.springmvc.resovler.SpringComponentTypeResolver;
import java.util.List;
import java.util.Optional;
import static com.kim.apidoc.core.schema.RequestParameterType.*;
import static com.github.fengyuchenglun.apidoc.core.schema.RequestParameterType.*;
/**
......@@ -157,7 +160,7 @@ public class SpringParser implements ParserStrategy {
if (ParameterHelper.isPathVariable(parameter)) {
section.getPathVariable().put(parameter.getNameAsString(), "");
Row row = new Row();
row.setRequestParameterType(PATH.name());
row.setRequestParameterType(PATH.getMsg());
row.setKey(parameter.getNameAsString());
row.setType(parameter.getType().toString());
// 路径参数必填
......@@ -236,7 +239,7 @@ public class SpringParser implements ParserStrategy {
} else if (description.isObject()) {
section.setParameter(description.asObject().getValue());
}
section.addRequestRows(description.rows(BODY.name()));
section.addRequestRows(description.rows(BODY.getMsg()));
}
break;
}
......@@ -295,11 +298,11 @@ public class SpringParser implements ParserStrategy {
}
}
section.setParameter(objectTypeDescription.getValue());
section.addRequestRows(objectTypeDescription.rows(QUERY.name()));
section.addRequestRows(objectTypeDescription.rows(QUERY.getMsg()));
}
/**
* 解析方法返回参
* 解析方法返回参数
*
* @param n the n
* @param chapter the chapter
......
package com.kim.apidoc.springmvc.resovler;
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;
package com.github.fengyuchenglun.apidoc.springmvc.resovler;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.common.description.TypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.description.UnAvailableTypeDescription;
import com.github.fengyuchenglun.apidoc.core.common.helper.TypeParameterHelper;
import com.github.fengyuchenglun.apidoc.core.resolver.TypeNameResolver;
import com.github.fengyuchenglun.apidoc.core.resolver.TypeResolver;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.resolution.types.ResolvedType;
......
com.github.fengyuchenglun.apidoc.springmvc.SpringParser
\ No newline at end of file
package com.kim.apidoc.springmvc;
package com.github.fengyuchenglun.apidoc.springmvc;
import com.kim.apidoc.core.ApiDoc;
import com.kim.apidoc.core.Context;
import com.kim.apidoc.core.common.diff.FileMatcher;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.Context;
import com.github.fengyuchenglun.apidoc.core.common.diff.FileMatcher;
import org.junit.Test;
import java.io.IOException;
......@@ -17,7 +17,7 @@ public class SpringTest {
Context context = new Context();
context.setId("test");
context.setName("测试项目");
context.addSource(Paths.get("K:\\@project-dianli@\\tool\\apidoc\\apidoc-springmvc\\src\\test\\java"));
context.addSource(Paths.get("F:\\@project@\\@dianli@\\tool\\apidoc\\apidoc-springmvc\\src\\test\\java"));
// context.setCss("https://darshandsoni.com/asciidoctor-skins/css/monospace.css");
ApiDoc apigcc = new ApiDoc(context);
......
package com.kim.apidoc.example;
import com.kim.apidoc.core.ApiDoc;
import com.kim.apidoc.core.Context;
import org.junit.Test;
import java.nio.file.Paths;
/**
* @title Apigcc示例文档
* @description 通过javadoc设置文档描述信息
* 优先级大于通过Environment.description()设置的值
* @readme 所有接口均使用Https调用
* /app路径下的接口为app专用
* /mini路径下的接口为小程序专用
*/
public class ApigccTest {
@Test
public void testApigcc() {
Context context = new Context();
context.setId("test");
context.setName("测试项目");
context.addSource(Paths.get("D:/apigcc/apigcc-demo-spring"));
//context.setCss("https://darshandsoni.com/asciidoctor-skins/css/monospace.css");
ApiDoc apigcc = new ApiDoc(context);
apigcc.parse();
apigcc.render();
}
package com.github.fengyuchenglun.example;
import com.github.fengyuchenglun.apidoc.core.ApiDoc;
import com.github.fengyuchenglun.apidoc.core.Context;
import org.junit.Test;
import java.nio.file.Paths;
/**
* @title Apigcc示例文档
* @description 通过javadoc设置文档描述信息
* 优先级大于通过Environment.description()设置的值
* @readme 所有接口均使用Https调用
* /app路径下的接口为app专用
* /mini路径下的接口为小程序专用
*/
public class ApigccTest {
@Test
public void testApigcc() {
Context context = new Context();
context.setId("test");
context.setName("测试项目");
context.addSource(Paths.get("D:/apigcc/apigcc-demo-spring"));
//context.setCss("https://darshandsoni.com/asciidoctor-skins/css/monospace.css");
ApiDoc apigcc = new ApiDoc(context);
apigcc.parse();
apigcc.render();
}
}
\ No newline at end of file
package com.kim.apidoc.example.annotation;
package com.github.fengyuchenglun.example.annotation;
import org.springframework.stereotype.Controller;
import java.lang.annotation.ElementType;
......
package com.kim.apidoc.example.annotation;
package com.github.fengyuchenglun.example.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
......
package com.kim.apidoc.example.common;
/**
* @code
*/
public enum Code{
OK(0,"ok"),
ERROR(-1,"error"),
NoAuth(1,"no auth");
private int code;
private String text;
Code(int code, String text) {
this.code = code;
this.text = text;
}
package com.github.fengyuchenglun.example.common;
/**
* @code
*/
public enum Code{
OK(0,"ok"),
ERROR(-1,"error"),
NoAuth(1,"no auth");
private int code;
private String text;
Code(int code, String text) {
this.code = code;
this.text = text;
}
}
\ No newline at end of file
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class Menu {
int id;
String name;
List<Menu> menus;
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class Menu {
int id;
String name;
List<Menu> menus;
}
package com.kim.apidoc.example.common;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Page extends Query {
/**
* 第几页
*/
@JsonProperty
int page = 1;
/* 每页条数 */
@JSONField(name = "limit")
int sizs = 20;
@SerializedName("totalPage")
int total = 0;
@JsonProperty("max")
int maxPage = 0;
}
package com.github.fengyuchenglun.example.common;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Page extends Query {
/**
* 第几页
*/
@JsonProperty
int page = 1;
/* 每页条数 */
@JSONField(name = "limit")
int sizs = 20;
@SerializedName("totalPage")
int total = 0;
@JsonProperty("max")
int maxPage = 0;
}
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Query {
/**
* static will be ignore
*/
public static final String CONSTANS = "";
/**
* 查询关键字
*/
String q = "123";
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Query {
/**
* static will be ignore
*/
public static final String CONSTANS = "";
/**
* 查询关键字
*/
String q = "123";
}
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
/**
* The type Result data.
*
* @param <T> the type parameter
* @author fengyuchenglun
* @version 1.0.0
* @resultData
*/
@Setter
@Getter
public class ResultData<T> {
/**
* 返回码
*/
int code;
/**
* The Msg.
*/
//返回信息
String msg;
/**
* The Data.
*/
T data;
/**
* Ok result data.
*
* @param <T> the type parameter
* @return the result data
*/
public static <T> ResultData<T> ok(){
return ok(null);
}
/**
* Ok result data.
*
* @param <T> the type parameter
* @param data the data
* @return the result data
*/
public static <T> ResultData<T> ok(T data){
ResultData<T> resultData = new ResultData<>();
resultData.code = 0;
resultData.msg = "ok";
resultData.data = data;
return resultData;
}
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
/**
* The type Result data.
*
* @param <T> the type parameter
* @author fengyuchenglun
* @version 1.0.0
* @resultData
*/
@Setter
@Getter
public class ResultData<T> {
/**
* 返回码
*/
int code;
/**
* The Msg.
*/
//返回信息
String msg;
/**
* The Data.
*/
T data;
/**
* Ok result data.
*
* @param <T> the type parameter
* @return the result data
*/
public static <T> ResultData<T> ok(){
return ok(null);
}
/**
* Ok result data.
*
* @param <T> the type parameter
* @param data the data
* @return the result data
*/
public static <T> ResultData<T> ok(T data){
ResultData<T> resultData = new ResultData<>();
resultData.code = 0;
resultData.msg = "ok";
resultData.data = data;
return resultData;
}
}
package com.kim.apidoc.example.common;
/**
* 用户角色
*
* @code
*/
public enum Role {
/**
* Admin role.
*/
ADMIN("管理员"),
/**
* User role.
*/
USER("用户"),
/**
* Vip role.
*/
VIP("会员");
/**
* The Text.
*/
String text;
/**
* Instantiates a new Role.
*
* @param text the text
*/
Role(String text) {
this.text = text;
}
}
package com.github.fengyuchenglun.example.common;
/**
* 用户角色
*
* @code
*/
public enum Role {
/**
* Admin role.
*/
ADMIN("管理员"),
/**
* User role.
*/
USER("用户"),
/**
* Vip role.
*/
VIP("会员");
/**
* The Text.
*/
String text;
/**
* Instantiates a new Role.
*
* @param text the text
*/
Role(String text) {
this.text = text;
}
}
package com.kim.apidoc.example.common;
/**
* @code
*/
public class StaticFinalCode {
/**
* 成功
*/
public static final int SUCCESS = 1;
/**
* 失败
*/
public static final int ERROR = -1;
}
package com.github.fengyuchenglun.example.common;
/**
* @code
*/
public class StaticFinalCode {
/**
* 成功
*/
public static final int SUCCESS = 1;
/**
* 失败
*/
public static final int ERROR = -1;
}
package com.kim.apidoc.example.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 用户对象
*
* @author fengyuchenglun
* @version 1.0.0
*/
@Setter
@Getter
public class User {
/**
* 用户编号.
*/
int id;
/**
* 用户名称.
*/
@NotBlank
String name;
/**
* 用户年龄.
*/
@Min(1)
@NotNull
Integer age;
/**
* 创建时间.
*/
Date createAt;
/**
* 性别.
*/
@NotBlank
@JsonProperty("Sex")
String sex;
}
package com.github.fengyuchenglun.example.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 用户对象
*
* @author fengyuchenglun
* @version 1.0.0
*/
@Setter
@Getter
public class User {
/**
* 用户编号.
*/
int id;
/**
* 用户名称.
*/
@NotBlank
String name;
/**
* 用户年龄.
*/
@Min(1)
@NotNull
Integer age;
/**
* 创建时间.
*/
Date createAt;
/**
* 性别.
*/
@NotBlank
@JsonProperty("Sex")
String sex;
}
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Setter
@Getter
public class UserDTO {
/**
* 编号
*/
Integer id;
/*姓名*/
@Size(min = 5, max = 20)
@NotEmpty
String name;
//年龄
@Min(1)
int age;
/**
* 生日,还是推荐使用javadoc
*/
@NotNull
Date birthday;
/**
* 用户标签
*/
@Size(min = 1, max = 2)
List<String> tags;
List<?> data;
/**
* 用户图标
*/
String[] icons;
Map<String, String> attrs;
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Setter
@Getter
public class UserDTO {
/**
* 编号
*/
Integer id;
/*姓名*/
@Size(min = 5, max = 20)
@NotEmpty
String name;
//年龄
@Min(1)
int age;
/**
* 生日,还是推荐使用javadoc
*/
@NotNull
Date birthday;
/**
* 用户标签
*/
@Size(min = 1, max = 2)
List<String> tags;
List<?> data;
/**
* 用户图标
*/
String[] icons;
Map<String, String> attrs;
}
package com.kim.apidoc.example.common;
/**
* 某些用户信息框架,如spring security的用户登录信息
* 此处只是模拟,真实的将调用security中的类
*/
public class UserDetails {
}
package com.github.fengyuchenglun.example.common;
/**
* 某些用户信息框架,如spring security的用户登录信息
* 此处只是模拟,真实的将调用security中的类
*/
public class UserDetails {
}
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class UserQuery extends Page {
/**
* 名称
* @value apigcc
*/
String name;
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class UserQuery extends Page {
/**
* 名称
* @value apigcc
*/
String name;
}
package com.kim.apidoc.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Wrapper<T> {
String wrapper;
T data;
}
package com.github.fengyuchenglun.example.common;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Wrapper<T> {
String wrapper;
T data;
}
package com.github.fengyuchenglun.example.spring.advanced;
import com.github.fengyuchenglun.example.annotation.KimController;
import com.github.fengyuchenglun.example.common.Query;
import com.github.fengyuchenglun.example.common.User;
import lombok.Data;
import org.springframework.web.bind.annotation.*;
import java.io.Serializable;
/**
* 用户接口.
*
* @author duanledexianxianxian
* @version 1.0.0
* @date 2020 /3/25 1:00
* @index 20
* @since 1.0.0
*/
@KimController
@RequestMapping("/api/v1/users")
public class UserController {
/**
* 查看用户详情
*
* @param userId 用户编号
* @param query 过滤条件
* @return 用户对象 user
*/
@GetMapping(value = "/{userId}")
public User detail(@PathVariable String userId, Query query) {
User user = new User();
return user;
}
/**
* 查看用户详情
*
* @param query 过滤条件
* @return 用户对象 user
*/
@GetMapping(value = "/detail1")
public User detail1( Query query) {
User user = new User();
return user;
}
/**
* 查看用户详情
*
* @param query 过滤条件
* @return 用户对象 user
*/
@GetMapping(value = "/detail3")
public User detail3(@RequestParam Query query) {
User user = new User();
return user;
}
/**
* 用户表单对象.
*
* @author duanledexianxianxian
*/
@Data
public static class UserForm implements Serializable {
private static final long serialVersionUID = 5681371348688016281L;
/**
* 用户名
*/
private String userName;
/**
* 地址
*/
private String address;
/**
* 年龄
*/
private Integer age;
}
/**
* 添加用户
*
* @param form 用户表单对象
* @return integer integer
*/
@PostMapping
public Integer add(@RequestBody UserForm form) {
return null;
}
}
package com.kim.apidoc.example.spring.advanced;
import com.kim.apidoc.example.annotation.KimController;
import com.kim.apidoc.example.common.Query;
import com.kim.apidoc.example.common.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* The type Kim user controller.
*
* @author duanledexianxianxian
* @version 1.0.0
* @date 2020 /3/25 1:00
* @index 20
* @since 1.0.0
*/
@KimController
@RequestMapping("/api/v1")
public class UserController {
/**
* 查看用户详情
*
* @param userId 用户编号
* @param query 过滤条件
* @return 用户对象 user
*/
@GetMapping(value = "/{userId}")
public User detail(@PathVariable String userId, Query query) {
User user = new User();
return user;
}
/**
* Add integer.
*
* @return integer integer
*/
@PostMapping
public Integer add() {
return null;
}
}
......@@ -4,8 +4,8 @@ allprojects {
apply plugin: 'maven'
apply plugin: 'com.novoda.bintray-release'
group 'com.apidoc'
version '1.7.0'
group 'com.github.fengyuchenglun'
version '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
......@@ -28,8 +28,8 @@ allprojects {
ext {
DESCRIPTION = 'A rest document generator with parse the source code.'
SITE_URL = 'https://github.com/apigcc/apigcc'
GIT_URL = 'https://github.com/apigcc/apigcc.git'
SITE_URL = 'http://platform.kuopu.net:9999/gitlab/duanledexianxianxian/apidoc'
GIT_URL = 'http://platform.kuopu.net:9999/gitlab/duanledexianxianxian/apidoc.git'
LICENSE = 'MIT License'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment