Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

String description() default "";

String[] value() default "";
String[] value() default {};

/**
* The schema type of the header value according to AsyncAPI specification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ private static List<String> getHeaderValues(
List<AsyncOperation.Headers.Header> value, StringValueResolver stringValueResolver) {
return value.stream()
.flatMap(it -> Arrays.stream(it.value()))
.filter(StringUtils::hasText)
.flatMap(text -> Optional.ofNullable(stringValueResolver.resolveStringValue(text)).stream())
.sorted()
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ void getAsyncHeadersWithoutValue() throws Exception {
assertThat(headerProperty.getExamples()).isNull();
}

@Test
void getAsyncHeadersWithEmptyValue() throws Exception {
// given
Method m = ClassWithHeaders.class.getDeclaredMethod("withEmptyValue", String.class);
AsyncOperation operation = m.getAnnotation(AsyncListener.class).operation();

// when
SchemaObject headers = AsyncAnnotationUtil.getAsyncHeaders(operation, stringValueResolver);

// then
SchemaObject headerProperty = (SchemaObject) headers.getProperties().get("headerResolved");
assertThat(headerProperty.getEnumValues()).containsExactly("Resolved");
assertThat(headerProperty.getExamples()).containsExactly("Resolved");
}

@Test
void getAsyncHeadersWithFormat() throws Exception {
// given
Expand Down Expand Up @@ -494,6 +509,19 @@ private void withMergedValue(String payload) {}
values = {@AsyncOperation.Headers.Header(name = "header")})))
private void withoutValue(String payload) {}

@AsyncListener(
operation =
@AsyncOperation(
channelName = "${test.property.test-channel}",
headers =
@AsyncOperation.Headers(
values = {
@AsyncOperation.Headers.Header(
name = "header",
value = {""})
})))
private void withEmptyValue(String payload) {}

@AsyncListener(
operation =
@AsyncOperation(
Expand Down
Loading