本文整理汇总了Java中io.swagger.models.parameters.QueryParameter.setRequired方法的典型用法代码示例。如果您正苦于以下问题:Java QueryParameter.setRequired方法的具体用法?Java QueryParameter.setRequired怎么用?Java QueryParameter.setRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.parameters.QueryParameter
的用法示例。
在下文中一共展示了QueryParameter.setRequired方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: opFactoryGetInstances
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
private io.swagger.models.Operation opFactoryGetInstances() {
io.swagger.models.Operation op = new io.swagger.models.Operation();
op.addTag(this.currentTag.getName());
op.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(template(ServiceDocumentQueryResult.class))));
op.setDescription("Query service instances");
for (String[] data : FACTORY_QUERY_PARAMS) {
QueryParameter p = new QueryParameter();
p.setName(data[0]);
p.setDescription(data[1]);
p.setType(data[2]);
p.setExample(data[3]);
p.setDefaultValue(data[4]);
p.setRequired(false);
op.addParameter(p);
}
return op;
}
示例2: testFillQueryStringParameter
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
@Test
public void testFillQueryStringParameter() {
for (int i = 0; i < 100; i++) {
SwagRequest request = new SwagRequest();
QueryParameter param = new QueryParameter();
param.setIn("query");
param.setType("string");
param.setName("testParam");
param.setRequired(true);
ParameterGenerator.fillParameter(swagger.getSwagger(), request, param, TestType.VALID);
assertNotNull(request.getQueryParameters());
assertEquals(1, request.getQueryParameters().size());
assertTrue(request.getQueryParameters().containsKey("testParam"));
assertTrue(request.getQueryParameters().get("testParam") instanceof String);
}
}
示例3: testFillQueryIntParameter
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
@Test
public void testFillQueryIntParameter() {
for (int i = 0; i < 100; i++) {
SwagRequest request = new SwagRequest();
QueryParameter param = new QueryParameter();
param.setIn("query");
param.setType("integer");
param.setName("testParam");
param.setRequired(true);
ParameterGenerator.fillParameter(swagger.getSwagger(), request, param, TestType.VALID);
assertNotNull(request.getQueryParameters());
assertEquals(1, request.getQueryParameters().size());
assertTrue(request.getQueryParameters().containsKey("testParam"));
assertTrue(request.getQueryParameters().get("testParam") instanceof Integer);
}
}
示例4: testFillQueryInt32Parameter
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
@Test
public void testFillQueryInt32Parameter() {
for (int i = 0; i < 100; i++) {
SwagRequest request = new SwagRequest();
QueryParameter param = new QueryParameter();
param.setIn("query");
param.setType("integer");
param.setFormat("int32");
param.setName("testParam");
param.setRequired(true);
ParameterGenerator.fillParameter(swagger.getSwagger(), request, param, TestType.VALID);
assertNotNull(request.getQueryParameters());
assertEquals(1, request.getQueryParameters().size());
assertTrue(request.getQueryParameters().containsKey("testParam"));
assertTrue(request.getQueryParameters().get("testParam") instanceof Integer);
}
}
示例5: testFillQueryInt64Parameter
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
@Test
public void testFillQueryInt64Parameter() {
for (int i = 0; i < 100; i++) {
SwagRequest request = new SwagRequest();
QueryParameter param = new QueryParameter();
param.setIn("query");
param.setType("integer");
param.setFormat("int64");
param.setName("testParam");
param.setRequired(true);
ParameterGenerator.fillParameter(swagger.getSwagger(), request, param, TestType.VALID);
assertNotNull(request.getQueryParameters());
assertEquals(1, request.getQueryParameters().size());
assertTrue(request.getQueryParameters().containsKey("testParam"));
assertTrue(request.getQueryParameters().get("testParam") instanceof Long);
}
}
示例6: paramQuery
import io.swagger.models.parameters.QueryParameter; //导入方法依赖的package包/类
/**
* Build QueryParameter for the Route parameter of type query.
*/
private QueryParameter paramQuery(RequestRouter.Parameter routeParam, Route route) {
QueryParameter queryParam = new QueryParameter();
queryParam.setName(routeParam.name);
queryParam.setDescription(isBlank(routeParam.description) ? route.description
: routeParam.description);
queryParam.setRequired(routeParam.required);
// Setting the type to be lowercase so that we match the swagger type.
queryParam.setType(routeParam.type != null ? routeParam.type.toLowerCase() : "");
queryParam.setDefaultValue(routeParam.value);
return queryParam;
}