Skip to content

Commit

Permalink
feature: adding OpenAPI support for multiple examples in the REST Lis…
Browse files Browse the repository at this point in the history
…tener.
  • Loading branch information
lorenzo committed Aug 24, 2020
1 parent 9ca9a79 commit ecea697
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,8 @@ private static Object parameterValueFrom(AnnotationInfo info, String parameterNa
private static <T> T annotationValueFrom(AnnotationInfo annotationInfo, T defaultValue) {
AnnotationParameterValueList parameterValues = annotationInfo.getParameterValues();
if (parameterValues == null) return defaultValue;
if (parameterValues.get(ANNOTATION_DEFAULT_PARAM_NAME) == null) {
return defaultValue;
} else {
Object value = parameterValues.getValue(ANNOTATION_DEFAULT_PARAM_NAME);
if (value instanceof AnnotationEnumValue) {
AnnotationEnumValue annotationEnumValue = (AnnotationEnumValue) value;
return (T) annotationEnumValue.getValueName();
} else {
return (T) value;
}
}
return parameterValues.get(ANNOTATION_DEFAULT_PARAM_NAME) == null ?
defaultValue :
(T) parameterValues.getValue(ANNOTATION_DEFAULT_PARAM_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.reedelk.module.descriptor.analyzer.component.ComponentAnalyzerContext;
import com.reedelk.module.descriptor.model.property.ListDescriptor;
import com.reedelk.module.descriptor.model.property.PropertyTypeDescriptor;
import com.reedelk.runtime.api.annotation.DialogTitle;
import com.reedelk.runtime.api.annotation.ListDisplayProperty;
import com.reedelk.runtime.api.annotation.TabGroup;
import com.reedelk.runtime.api.commons.PlatformTypes;
Expand All @@ -26,6 +27,7 @@ public boolean test(String fullyQualifiedClassName, FieldInfo fieldInfo, Compone
@Override
public PropertyTypeDescriptor create(String fullyQualifiedClassName, FieldInfo fieldInfo, ComponentAnalyzerContext context) {
String tabGroup = annotationValueFrom(fieldInfo, TabGroup.class, null);
String dialogTitle = annotationValueFrom(fieldInfo, DialogTitle.class, null);
String listDisplayProperty = annotationValueFrom(fieldInfo, ListDisplayProperty.class, null);

// We must find out the value type of the List.
Expand All @@ -41,6 +43,7 @@ public PropertyTypeDescriptor create(String fullyQualifiedClassName, FieldInfo f

ListDescriptor descriptor = new ListDescriptor();
descriptor.setListDisplayProperty(listDisplayProperty);
descriptor.setDialogTitle(dialogTitle);
descriptor.setValueType(valueType);
descriptor.setTabGroup(tabGroup);
return descriptor;
Expand Down

0 comments on commit ecea697

Please sign in to comment.