Java Code Examples for io.swagger.v3.oas.models.parameters.Parameter#setAllowEmptyValue()

The following examples show how to use io.swagger.v3.oas.models.parameters.Parameter#setAllowEmptyValue() . 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: OASMergeUtil.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
public static Parameter mergeParameter(Parameter thisParameter, Parameter thatParameter) {
  if (thatParameter.getName() != null) {
    thisParameter.setName(thatParameter.getName());
  }
  if (thatParameter.getIn() != null) {
    thisParameter.setIn(thatParameter.getIn());
  }
  if (thatParameter.getDescription() != null) {
    thisParameter.setDescription(thatParameter.getDescription());
  }
  if (thatParameter.getRequired() != null) {
    thisParameter.setRequired(thatParameter.getRequired());
  }
  if (thatParameter.getDeprecated() != null) {
    thisParameter.setDeprecated(thatParameter.getDeprecated());
  }
  if (thatParameter.getAllowEmptyValue() != null) {
    thisParameter.setAllowEmptyValue(thatParameter.getAllowEmptyValue());
  }
  if (thatParameter.get$ref() != null) {
    thisParameter.set$ref(thatParameter.get$ref());
  }
  return thisParameter;
}
 
Example 2
Source File: GenericParameterBuilder.java    From springdoc-openapi with Apache License 2.0 5 votes vote down vote up
/**
 * Build parameter from doc parameter.
 *
 * @param parameterDoc the parameter doc
 * @param components the components
 * @param jsonView the json view
 * @return the parameter
 */
public Parameter buildParameterFromDoc(io.swagger.v3.oas.annotations.Parameter parameterDoc,
		Components components, JsonView jsonView) {
	Parameter parameter = new Parameter();
	if (StringUtils.isNotBlank(parameterDoc.description()))
		parameter.setDescription(propertyResolverUtils.resolve(parameterDoc.description()));
	if (StringUtils.isNotBlank(parameterDoc.name()))
		parameter.setName(propertyResolverUtils.resolve(parameterDoc.name()));
	if (StringUtils.isNotBlank(parameterDoc.in().toString()))
		parameter.setIn(parameterDoc.in().toString());
	if (StringUtils.isNotBlank(parameterDoc.example())) {
		try {
			parameter.setExample(Json.mapper().readTree(parameterDoc.example()));
		}
		catch (IOException e) {
			parameter.setExample(parameterDoc.example());
		}
	}
	if (parameterDoc.deprecated())
		parameter.setDeprecated(parameterDoc.deprecated());
	if (parameterDoc.required())
		parameter.setRequired(parameterDoc.required());
	if (parameterDoc.allowEmptyValue())
		parameter.setAllowEmptyValue(parameterDoc.allowEmptyValue());
	if (parameterDoc.allowReserved())
		parameter.setAllowReserved(parameterDoc.allowReserved());

	setSchema(parameterDoc, components, jsonView, parameter);
	setExamples(parameterDoc, parameter);
	setExtensions(parameterDoc, parameter);
	setParameterStyle(parameter, parameterDoc);
	setParameterExplode(parameter, parameterDoc);

	return parameter;
}
 
Example 3
Source File: GenericParameterBuilder.java    From springdoc-openapi with Apache License 2.0 4 votes vote down vote up
/**
 * Merge parameter.
 *
 * @param paramCalcul the param calcul
 * @param paramDoc the param doc
 */
private static void mergeParameter(Parameter paramCalcul, Parameter paramDoc) {
	if (StringUtils.isBlank(paramDoc.getDescription()))
		paramDoc.setDescription(paramCalcul.getDescription());

	if (StringUtils.isBlank(paramDoc.getIn()))
		paramDoc.setIn(paramCalcul.getIn());

	if (paramDoc.getExample() == null)
		paramDoc.setExample(paramCalcul.getExample());

	if (paramDoc.getDeprecated() == null)
		paramDoc.setDeprecated(paramCalcul.getDeprecated());

	if (paramDoc.getRequired() == null)
		paramDoc.setRequired(paramCalcul.getRequired());

	if (paramDoc.getAllowEmptyValue() == null)
		paramDoc.setAllowEmptyValue(paramCalcul.getAllowEmptyValue());

	if (paramDoc.getAllowReserved() == null)
		paramDoc.setAllowReserved(paramCalcul.getAllowReserved());

	if (StringUtils.isBlank(paramDoc.get$ref()))
		paramDoc.set$ref(paramDoc.get$ref());

	if (paramDoc.getSchema() == null)
		paramDoc.setSchema(paramCalcul.getSchema());

	if (paramDoc.getExamples() == null)
		paramDoc.setExamples(paramCalcul.getExamples());

	if (paramDoc.getExtensions() == null)
		paramDoc.setExtensions(paramCalcul.getExtensions());

	if (paramDoc.getStyle() == null)
		paramDoc.setStyle(paramCalcul.getStyle());

	if (paramDoc.getExplode() == null)
		paramDoc.setExplode(paramCalcul.getExplode());
}