Search in sources :

Example 11 with Parameter

use of org.motechproject.mds.docs.swagger.model.Parameter in project motech by motech.

the class SwaggerGenerator method includeBlobParameter.

private Parameter includeBlobParameter(Locale locale) {
    Parameter includeBlobParameter = queryParameter(INCLUDE_BLOB_PARAM, msg(locale, BLOB_DESC_KEY), STRING_TYPE);
    includeBlobParameter.setEnumValues(Arrays.asList("true", "false"));
    return includeBlobParameter;
}
Also used : Parameter(org.motechproject.mds.docs.swagger.model.Parameter)

Example 12 with Parameter

use of org.motechproject.mds.docs.swagger.model.Parameter in project motech by motech.

the class SwaggerGenerator method lookupParameters.

private List<Parameter> lookupParameters(Entity entity, Lookup lookup, Locale locale) {
    List<Parameter> parameters = new ArrayList<>();
    for (String lookupFieldName : lookup.getFieldsOrder()) {
        LookupFieldType lookupFieldType = lookup.getLookupFieldType(lookupFieldName);
        Field lookupField;
        if (lookupFieldName.contains(".")) {
            lookupField = getRelatedField(lookup.getLookupFieldByName(LookupName.getFieldName(lookupFieldName)).getMetadata(Constants.MetadataKeys.RELATED_CLASS).getValue(), LookupName.getRelatedFieldName(lookupFieldName));
        } else {
            lookupField = lookup.getLookupFieldByName(lookupFieldName);
        }
        String paramDesc = lookupParamDescription(lookupField, lookupFieldType, locale);
        Parameter parameter = SwaggerFieldConverter.lookupParameter(lookupFieldName, lookupField, lookupFieldType, paramDesc);
        parameters.add(parameter);
    }
    parameters.addAll(queryParamsParameters(entity.getFieldsExposedByRest(), locale));
    return parameters;
}
Also used : Field(org.motechproject.mds.domain.Field) ArrayList(java.util.ArrayList) Parameter(org.motechproject.mds.docs.swagger.model.Parameter) LookupFieldType(org.motechproject.mds.dto.LookupFieldType)

Example 13 with Parameter

use of org.motechproject.mds.docs.swagger.model.Parameter in project motech by motech.

the class SwaggerGenerator method parameter.

private Parameter parameter(String name, String description, String type, String format, ParameterType in, boolean required) {
    final Parameter param = new Parameter();
    param.setName(name);
    param.setDescription(description);
    param.setIn(in);
    param.setRequired(required);
    param.setType(type);
    param.setFormat(format);
    return param;
}
Also used : Parameter(org.motechproject.mds.docs.swagger.model.Parameter)

Aggregations

Parameter (org.motechproject.mds.docs.swagger.model.Parameter)13 Response (org.motechproject.mds.docs.swagger.model.Response)6 ResponseWithSchema (org.motechproject.mds.docs.swagger.model.ResponseWithSchema)5 Property (org.motechproject.mds.docs.swagger.model.Property)2 ArrayList (java.util.ArrayList)1 Field (org.motechproject.mds.domain.Field)1 LookupFieldType (org.motechproject.mds.dto.LookupFieldType)1