-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add key filter support in openapi asyncapi mapping #851
Conversation
@@ -119,6 +122,8 @@ private <C> BindingConfigBuilder<C> injectHttpKafkaRoutes( | |||
final AsyncapiChannelView channel = AsyncapiChannelView | |||
.of(asyncapi.channels, asyncapiOperation.channel); | |||
|
|||
final boolean includeKey = pathId.reset(item).find(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should not depend on the name of the parameter being id
, for example taxiId
should be fine too.
Also, the terminology includeKey
is describing anticipated usage of the parameter, which is leaking the abstraction a bit. Instead, lets call this hasParam
, or perhaps even passing the parameter name(s) so we are not so dependent on it being {id}
in the path vs {taxiId}
for example.
if (includeKey) | ||
{ | ||
fetch.filters(List.of(HttpKafkaWithFetchFilterConfig.builder() | ||
.key("${params.id}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.key("${params.id}") | |
.key(String.format("${params.%s}", paramName)) |
"fixed-tag"))))) | ||
.filters(singletonList(HttpKafkaWithFetchFilterConfig.builder() | ||
.key("fixed-key") | ||
.headers(singletonList(HttpKafkaWithFetchFilterHeaderConfig.builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a .header(String name, String value)
method on the builder that lazily instantiates the headers
list and adds the header config.
@@ -49,8 +51,10 @@ | |||
public final class OpenapiAsyncCompositeBindingAdapter implements CompositeBindingAdapterSpi | |||
{ | |||
private static final Pattern JSON_CONTENT_TYPE = Pattern.compile("^application/(?:.+\\+)?json$"); | |||
private static final Pattern PARAMETER_PATTERN = Pattern.compile("\\{([^}]*)\\}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final Pattern PARAMETER_PATTERN = Pattern.compile("\\{([^}]*)\\}"); | |
private static final Pattern PARAMETER_PATTERN = Pattern.compile("\\{([^}]+)\\}"); |
We require at least one character for parameter name, agree?
Description
Add key filter support in openapi asyncapi mapping.