Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: request part annotation #739

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading