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; }
private void buildDefinitionProperties( Map<String, Property> properties, List<String> required, Entity entity, boolean includeAuto, boolean includeId) { if (includeId) { properties.put(Constants.Util.ID_FIELD_NAME, new Property(INTEGER_TYPE, INT64_FORMAT)); } for (Field field : entity.getFields()) { final String fieldName = field.getName(); if (field.isExposedViaRest()) { // auto generated fields included only in responses if (!field.isAutoGenerated() || includeAuto) { Property property = SwaggerFieldConverter.fieldToProperty(field); properties.put(fieldName, property); if (field.isRequired()) { required.add(fieldName); } } } } }