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 @@ -731,7 +731,19 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
config.put("userAgent", "{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}");
}

return WebClient.create(vertx, new WebClientOptions(config){{#useVertx5}}, new PoolOptions(poolConfig){{/useVertx5}});
{{#useVertx5}}
// PoolOptions(JsonObject) does not initialize defaults first (unlike its
// no-arg constructor and unlike WebClientOptions(JsonObject)), so building
// it directly from an empty or partial poolConfig leaves fields such as
// maxLifetimeUnit null and triggers a NullPointerException when the
// WebClient is created. Overlay poolConfig on the serialized defaults so
// absent keys keep their documented values.
PoolOptions poolOptions = new PoolOptions(new PoolOptions().toJson().mergeIn(poolConfig));
return WebClient.create(vertx, new WebClientOptions(config), poolOptions);
{{/useVertx5}}
{{^useVertx5}}
return WebClient.create(vertx, new WebClientOptions(config));
{{/useVertx5}}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,14 @@ protected WebClient buildWebClient(Vertx vertx, JsonObject config, JsonObject po
config.put("userAgent", "OpenAPI-Generator/1.0.0/java");
}

return WebClient.create(vertx, new WebClientOptions(config), new PoolOptions(poolConfig));
// PoolOptions(JsonObject) does not initialize defaults first (unlike its
// no-arg constructor and unlike WebClientOptions(JsonObject)), so building
// it directly from an empty or partial poolConfig leaves fields such as
// maxLifetimeUnit null and triggers a NullPointerException when the
// WebClient is created. Overlay poolConfig on the serialized defaults so
// absent keys keep their documented values.
PoolOptions poolOptions = new PoolOptions(new PoolOptions().toJson().mergeIn(poolConfig));
return WebClient.create(vertx, new WebClientOptions(config), poolOptions);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,14 @@ protected WebClient buildWebClient(Vertx vertx, JsonObject config, JsonObject po
config.put("userAgent", "OpenAPI-Generator/1.0.0/java");
}

return WebClient.create(vertx, new WebClientOptions(config), new PoolOptions(poolConfig));
// PoolOptions(JsonObject) does not initialize defaults first (unlike its
// no-arg constructor and unlike WebClientOptions(JsonObject)), so building
// it directly from an empty or partial poolConfig leaves fields such as
// maxLifetimeUnit null and triggers a NullPointerException when the
// WebClient is created. Overlay poolConfig on the serialized defaults so
// absent keys keep their documented values.
PoolOptions poolOptions = new PoolOptions(new PoolOptions().toJson().mergeIn(poolConfig));
return WebClient.create(vertx, new WebClientOptions(config), poolOptions);
}


Expand Down
Loading