本文整理汇总了Java中io.swagger.models.parameters.BodyParameter.setSchema方法的典型用法代码示例。如果您正苦于以下问题:Java BodyParameter.setSchema方法的具体用法?Java BodyParameter.setSchema怎么用?Java BodyParameter.setSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.parameters.BodyParameter
的用法示例。
在下文中一共展示了BodyParameter.setSchema方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paramBody
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
/**
* Build BodyParameter for the Route parameter of type body.
*/
private BodyParameter paramBody(List<RequestRouter.Parameter> routeParams, Route route) {
BodyParameter bodyParam = new BodyParameter();
bodyParam.setRequired(false);
Model model = new ModelImpl();
if (routeParams != null) {
Map<String, Property> properties = new HashMap<>(routeParams.size());
routeParams.stream().forEach((p) -> {
StringProperty stringProperty = new StringProperty();
stringProperty.setName(p.name);
stringProperty
.setDescription(isBlank(p.description) ? route.description : p.description);
stringProperty.setDefault(p.value);
stringProperty.setRequired(p.required);
stringProperty.setType(StringProperty.TYPE);
properties.put(p.name, stringProperty);
});
model.setProperties(properties);
}
bodyParam.setSchema(model);
return bodyParam;
}
示例2: testFillBodyStringParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
@Test
public void testFillBodyStringParameter() {
for (int i = 0; i < 100; i++) {
SwagRequest request = new SwagRequest();
RefModel ref = new RefModel();
ref.set$ref("#/definitions/Pet");
BodyParameter param = new BodyParameter();
param.setIn("body");
param.setName("testParam");
param.setSchema(ref);
param.setRequired(true);
ParameterGenerator.fillParameter(swagger.getSwagger(), request, param, TestType.VALID);
assertNotNull(request.getBodyParameters());
}
}
示例3: createBodyParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
public BodyParameter createBodyParameter(String paramName) {
String modelType = ParamUtils.generateBodyParameterName(operationGenerator.getProviderMethod());
RefModel model = toRefModel(modelType);
BodyParameter bodyParameter = new BodyParameter();
bodyParameter.setName(paramName);
bodyParameter.setSchema(model);
return bodyParameter;
}
示例4: createBodyParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
public static BodyParameter createBodyParameter(Swagger swagger, String paramName, Type paramType) {
addDefinitions(swagger, paramType);
Property property = ModelConverters.getInstance().readAsProperty(paramType);
Model model = PropertyBuilder.toModel(property);
BodyParameter bodyParameter = new BodyParameter();
bodyParameter.setName(paramName);
bodyParameter.setSchema(model);
return bodyParameter;
}
示例5: createBodyRefParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
private List<Parameter> createBodyRefParameter() {
BodyParameter bodyParameter = new BodyParameter();
RefModel schema = new RefModel();
schema.set$ref("myref");
bodyParameter.setSchema(schema);
List<Parameter> parameters = new ArrayList<>();
parameters.add(bodyParameter);
return parameters;
}
示例6: createBodyParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
private List<Parameter> createBodyParameter(String object) {
BodyParameter bodyParameter = new BodyParameter();
ModelImpl schema = new ModelImpl();
schema.setType(object);
bodyParameter.setSchema(schema);
List<Parameter> parameters = new ArrayList<>();
parameters.add(bodyParameter);
return parameters;
}
示例7: buildBodyParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
private BodyParameter buildBodyParameter(VariableElement variableElement) {
BodyParameter bodyParameter = new BodyParameter();
bodyParameter.setName(variableElement.getSimpleName().toString());
bodyParameter.setRequired(true);
bodyParameter.setSchema(new ModelImpl().type(ModelImpl.OBJECT));
return bodyParameter;
}
示例8: getBodyParameter
import io.swagger.models.parameters.BodyParameter; //导入方法依赖的package包/类
private static BodyParameter getBodyParameter(String requestModelName, boolean inlineBodyParameterSchema,
Swagger swagger, Map<String, Integer> modelRefCount) {
BodyParameter parameter = new BodyParameter().name("body").description(requestModelName);
if (inlineBodyParameterSchema && !modelRefCount.containsKey(requestModelName)) {
parameter.setSchema(swagger.getDefinitions().remove(requestModelName));
} else {
parameter.setSchema(new RefModel(requestModelName));
}
return parameter;
}