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

The following examples show how to use io.swagger.v3.oas.models.parameters.Parameter#getStyle() . 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: InputModeller.java    From tcases with MIT License 6 votes vote down vote up
/**
 * Returns the style of the given parameter.
 */
private Parameter.StyleEnum parameterStyle( Parameter parameter, String parameterType)
  {
  String in = parameter.getIn();
  
  return
    parameter.getStyle() != null?
    getApplicableStyle( parameter, parameterType) :

    in.equals( "path")?
    Parameter.StyleEnum.SIMPLE :

    in.equals( "header")?
    Parameter.StyleEnum.SIMPLE :

    Parameter.StyleEnum.FORM;
  }
 
Example 2
Source File: OpenApi3Utils.java    From vertx-web with Apache License 2.0 5 votes vote down vote up
public static String resolveStyle(Parameter param) {
  if (param.getStyle() != null) return param.getStyle().toString();
  else switch (param.getIn()) {
    case "query":
      return "form";
    case "path":
      return "simple";
    case "header":
      return "simple";
    case "cookie":
      return "form";
    default:
      return null;
  }
}
 
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());
}
 
Example 4
Source File: OpenAPI3PathResolver.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
private String solveParamStyle(Parameter parameter) {
  return (parameter.getStyle() != null) ? parameter.getStyle().toString() : "simple";
}