use of io.swagger.models.parameters.CookieParameter in project swagger-core by swagger-api.
the class DefaultParameterExtension method extractParameters.
@Override
public List<Parameter> extractParameters(List<Annotation> annotations, Type type, Set<Type> typesToSkip, Iterator<SwaggerExtension> chain) {
if (shouldIgnoreType(type, typesToSkip)) {
return new ArrayList<Parameter>();
}
List<Parameter> parameters = new ArrayList<Parameter>();
Parameter parameter = null;
for (Annotation annotation : annotations) {
if (annotation instanceof QueryParam) {
QueryParam param = (QueryParam) annotation;
QueryParameter qp = new QueryParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
qp.setProperty(schema);
}
parameter = qp;
} else if (annotation instanceof PathParam) {
PathParam param = (PathParam) annotation;
PathParameter pp = new PathParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
pp.setProperty(schema);
}
parameter = pp;
} else if (annotation instanceof HeaderParam) {
HeaderParam param = (HeaderParam) annotation;
HeaderParameter hp = new HeaderParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
hp.setProperty(schema);
}
parameter = hp;
} else if (annotation instanceof CookieParam) {
CookieParam param = (CookieParam) annotation;
CookieParameter cp = new CookieParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
cp.setProperty(schema);
}
parameter = cp;
} else if (annotation instanceof FormParam) {
FormParam param = (FormParam) annotation;
FormParameter fp = new FormParameter().name(param.value());
Property schema = createProperty(type);
if (schema != null) {
fp.setProperty(schema);
}
parameter = fp;
} else {
handleAdditionalAnnotation(parameters, annotation, type, typesToSkip);
}
}
if (parameter != null) {
parameters.add(parameter);
}
return parameters;
}
Aggregations