use of com.palantir.conjure.spec.ExternalReference in project conjure-postman by palantir.
the class BodyParameterTypeVisitor method visitBody.
@Override
public Optional<PostmanRequest.Body> visitBody(BodyParameterType _value) {
TemplateTypeVisitor visitor = new TemplateTypeVisitor(types);
Type type = argumentDefinition.getType();
return type.accept(new Type.Visitor<Optional<PostmanRequest.Body>>() {
@Override
public Optional<PostmanRequest.Body> visitPrimitive(PrimitiveType value) {
switch(value.get()) {
case BINARY:
return Optional.of(PostmanRequest.FileBody.builder().build());
default:
return rawBody(visitor.visitPrimitive(value));
}
}
@Override
public Optional<PostmanRequest.Body> visitOptional(OptionalType value) {
return rawBody(visitor.visitOptional(value));
}
@Override
public Optional<PostmanRequest.Body> visitList(ListType value) {
return rawBody(visitor.visitList(value));
}
@Override
public Optional<PostmanRequest.Body> visitSet(SetType value) {
return rawBody(visitor.visitSet(value));
}
@Override
public Optional<PostmanRequest.Body> visitMap(MapType value) {
return rawBody(visitor.visitMap(value));
}
@Override
public Optional<PostmanRequest.Body> visitReference(TypeName value) {
return rawBody(visitor.visitReference(value));
}
@Override
public Optional<PostmanRequest.Body> visitExternal(ExternalReference value) {
return rawBody(visitor.visitExternal(value));
}
@Override
public Optional<PostmanRequest.Body> visitUnknown(String _unknownType) {
return Optional.empty();
}
});
}
Aggregations