Java Code Examples for io.swagger.models.parameters.BodyParameter#setDescription()

The following examples show how to use io.swagger.models.parameters.BodyParameter#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOperationGenerator.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
private void mergeBodyParameter(BodyParameter bodyParameter, BodyParameter fromBodyParameter) {
  if (fromBodyParameter.getExamples() != null) {
    bodyParameter.setExamples(fromBodyParameter.getExamples());
  }
  if (fromBodyParameter.getRequired()) {
    bodyParameter.setRequired(true);
  }
  if (StringUtils.isNotEmpty(fromBodyParameter.getDescription())) {
    bodyParameter.setDescription(fromBodyParameter.getDescription());
  }
  if (StringUtils.isNotEmpty(fromBodyParameter.getAccess())) {
    bodyParameter.setAccess(fromBodyParameter.getAccess());
  }
  if (fromBodyParameter.getSchema() != null) {
    bodyParameter.setSchema(fromBodyParameter.getSchema());
  }
}
 
Example 2
Source File: OperationsTransformer.java    From spring-openapi with MIT License 5 votes vote down vote up
private io.swagger.models.parameters.Parameter createStandardRequestBody(Method method, ParameterNamePair requestBodyParameter, ModelImpl content,
																		 Property property) {
	BodyParameter requestBody = new BodyParameter();
	requestBody.setSchema(content);
	requestBody.setRequired(true);
	requestBody.setName(resolveRequestBodyName(property, requestBodyParameter.getName()));
	requestBody.setDescription(requestBody.getName());

	requestBodyInterceptors.forEach(interceptor ->
											interceptor.intercept(method, requestBodyParameter.getParameter(), requestBodyParameter.getName(), requestBody)
	);

	return requestBody;
}
 
Example 3
Source File: ReplaceDefinitionsProcessor.java    From yang2swagger with Eclipse Public License 1.0 5 votes vote down vote up
private void fixParameter(Parameter p, Map<String, String> replacements) {
    if(!(p instanceof BodyParameter)) return;
    BodyParameter bp = (BodyParameter) p;
    if(!(bp.getSchema() instanceof RefModel)) return;
    RefModel ref = (RefModel) bp.getSchema();
    if(replacements.containsKey(ref.getSimpleRef())) {
        String replacement = replacements.get(ref.getSimpleRef());
        bp.setDescription(bp.getDescription().replace(ref.getSimpleRef(), replacement));
        bp.setSchema(new RefModel(replacement));
    }

}
 
Example 4
Source File: TestRequestBodyInterceptor.java    From spring-openapi with MIT License 4 votes vote down vote up
@Override
public void intercept(Method method, Parameter parameter, String parameterName, BodyParameter transformedRequestBody) {
	transformedRequestBody.setDescription(TestUtils.emptyIfNull(transformedRequestBody.getDescription()) + ". Test requestBody interceptor");
}