Skip to content

Commit

Permalink
Merge pull request #739 from shalousun/master
Browse files Browse the repository at this point in the history
add: request part annotation
  • Loading branch information
shalousun authored Feb 20, 2024
2 parents 38d6c9f + 908435a commit 7da5b8c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/ly/doc/constants/SpringMvcAnnotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public interface SpringMvcAnnotations {

String REQUEST_PARAM = "RequestParam";

String REQUEST_PART = "RequestPart";

String REQUEST_BODY = "RequestBody";

String CONTROLLER = "Controller";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class FrameworkAnnotations {

private RequestBodyAnnotation requestBodyAnnotation;

private RequestPartAnnotation requestPartAnnotation;

public static FrameworkAnnotations builder() {
return new FrameworkAnnotations();
}
Expand Down Expand Up @@ -96,4 +98,13 @@ public FrameworkAnnotations setRequestBodyAnnotation(RequestBodyAnnotation reque
this.requestBodyAnnotation = requestBodyAnnotation;
return this;
}

public RequestPartAnnotation getRequestPartAnnotation() {
return requestPartAnnotation;
}

public FrameworkAnnotations setRequestPartAnnotation(RequestPartAnnotation requestPartAnnotation) {
this.requestPartAnnotation = requestPartAnnotation;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.ly.doc.model.annotation;

public class RequestPartAnnotation {

private String annotationName;

private String annotationFullyName;

private String defaultValueProp;

private String requiredProp;

public static RequestPartAnnotation builder() {
return new RequestPartAnnotation();
}

public String getAnnotationName() {
return annotationName;
}

public RequestPartAnnotation setAnnotationName(String annotationName) {
this.annotationName = annotationName;
return this;
}

public String getAnnotationFullyName() {
return annotationFullyName;
}

public RequestPartAnnotation setAnnotationFullyName(String annotationFullyName) {
this.annotationFullyName = annotationFullyName;
return this;
}

public String getDefaultValueProp() {
return defaultValueProp;
}

public RequestPartAnnotation setDefaultValueProp(String defaultValueProp) {
this.defaultValueProp = defaultValueProp;
return this;
}

public String getRequiredProp() {
return requiredProp;
}

public RequestPartAnnotation setRequiredProp(String requiredProp) {
this.requiredProp = requiredProp;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public FrameworkAnnotations registeredAnnotations() {
.setRequiredProp(DocAnnotationConstants.REQUIRED_PROP);
annotations.setRequestParamAnnotation(requestAnnotation);

// request part annotation
RequestPartAnnotation requestPartAnnotation = RequestPartAnnotation.builder()
.setAnnotationName(SpringMvcAnnotations.REQUEST_PART)
.setDefaultValueProp(DocAnnotationConstants.DEFAULT_VALUE_PROP)
.setRequiredProp(DocAnnotationConstants.REQUIRED_PROP);
annotations.setRequestPartAnnotation(requestPartAnnotation);

// add path variable annotation
PathVariableAnnotation pathVariableAnnotation = PathVariableAnnotation.builder()
.setAnnotationName(SpringMvcAnnotations.PATH_VARIABLE)
Expand Down

0 comments on commit 7da5b8c

Please sign in to comment.