private Parameter fromApiModelProperty(ApiModelProperty apiModelProperty) { String allowableProperty = emptyToNull(apiModelProperty.allowableValues()); AllowableValues allowable = allowableValues(fromNullable(allowableProperty), field); return new com.mangofactory.swagger.models.dto.builder.ParameterBuilder() .name(isNullOrEmpty(parentName) ? field.getName() : String.format("%s.%s", parentName, field.getName())) .description(apiModelProperty.value()) .defaultValue(null) .required(apiModelProperty.required()) .allowMultiple(Boolean.FALSE) .dataType(dataTypeName) .allowableValues(allowable).parameterType("query") .parameterAccess(apiModelProperty.access()) .build(); }
private void fromApiModelProperty(ParameterExpansionContext context, ApiModelProperty apiModelProperty) { String allowableProperty = emptyToNull(apiModelProperty.allowableValues()); AllowableValues allowable = allowableValues(fromNullable(allowableProperty), context.getField()); String name = isNullOrEmpty(context.getParentName()) ? context.getField().getName() : String.format("%s.%s", context.getParentName(), context.getField().getName()); context.getParameterBuilder() .name(name) .description(apiModelProperty.value()) .defaultValue(null) .required(apiModelProperty.required()) .allowMultiple(Boolean.FALSE) .modelRef(new ModelRef(context.getDataTypeName())) .allowableValues(allowable).parameterType("query") .parameterAccess(apiModelProperty.access()) .build(); }
/** * Adds data from the {@link ApiModelProperty} annotation to the * representation property. * * @param apiModelProperty * The {@link ApiModelProperty} annotation. * @param property * The {@link Property} to update. */ public static void processApiModelProperty( ApiModelProperty apiModelProperty, Property property) { if (!StringUtils.isNullOrEmpty(apiModelProperty.value())) { property.setDescription(apiModelProperty.value()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.dataType())) { property.setType(apiModelProperty.dataType()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.allowableValues())) { property.setRequired(true); property.setList(true); } }
/** * Adds data from the {@link ApiModelProperty} annotation to the * representation property. * * @param apiModelProperty * The {@link ApiModelProperty} annotation. * @param property * The {@link Property} to update. */ public static void processApiModelProperty( ApiModelProperty apiModelProperty, Property property) { if (!StringUtils.isNullOrEmpty(apiModelProperty.value())) { property.setDescription(apiModelProperty.value()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.dataType())) { property.setType(apiModelProperty.dataType()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.allowableValues())) { property.setRequired(true); property.setList(true); } }
/** * Adds data from the {@link ApiModelProperty} annotation to the * representation property. * * @param apiModelProperty * The {@link ApiModelProperty} annotation. * @param property * The {@link Property} to update. */ public static void processApiModelProperty( ApiModelProperty apiModelProperty, Property property) { if (!StringUtils.isNullOrEmpty(apiModelProperty.value())) { property.setDescription(apiModelProperty.value()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.dataType())) { property.setType(apiModelProperty.dataType()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.allowableValues())) { property.setRequired(true); property.setList(true); } }
/** * Adds data from the {@link ApiModelProperty} annotation to the * representation property. * * @param apiModelProperty * The {@link ApiModelProperty} annotation. * @param property * The {@link Property} to update. */ public static void processApiModelProperty( ApiModelProperty apiModelProperty, Property property) { if (!StringUtils.isNullOrEmpty(apiModelProperty.value())) { property.setDescription(apiModelProperty.value()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.dataType())) { property.setType(apiModelProperty.dataType()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.allowableValues())) { property.setRequired(true); property.setList(true); } }
/** * Adds data from the {@link ApiModelProperty} annotation to the * representation property. * * @param apiModelProperty * The {@link ApiModelProperty} annotation. * @param property * The {@link Property} to update. */ public static void processApiModelProperty( ApiModelProperty apiModelProperty, Property property) { if (!StringUtils.isNullOrEmpty(apiModelProperty.value())) { property.setDescription(apiModelProperty.value()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.dataType())) { property.setType(apiModelProperty.dataType()); } if (!StringUtils.isNullOrEmpty(apiModelProperty.allowableValues())) { property.setRequired(true); property.setList(true); } }