Skip to content
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

Bump smallrye-open-api to 4.0.1; Avoid Windows JAR locking #44199

Merged
merged 1 commit into from
Nov 4, 2024
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
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<smallrye-config.version>3.10.0</smallrye-config.version>
<smallrye-health.version>4.1.0</smallrye-health.version>
<smallrye-metrics.version>4.0.0</smallrye-metrics.version>
<smallrye-open-api.version>4.0.0</smallrye-open-api.version>
<smallrye-open-api.version>4.0.1</smallrye-open-api.version>
<smallrye-graphql.version>2.11.0</smallrye-graphql.version>
<smallrye-fault-tolerance.version>6.6.1</smallrye-fault-tolerance.version>
<smallrye-jwt.version>4.6.0</smallrye-jwt.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,18 @@ Map.<String, Supplier<String>> entry("YAML", openAPI::toYAML))
}
});

@SuppressWarnings("deprecation")
openApiDocumentProducer.produce(new OpenApiDocumentBuildItem(toOpenApiDocument(finalOpenAPI)));
}

/**
* We need to use the deprecated OpenApiDocument as long as
* OpenApiDocumentBuildItem needs to be produced.
*/
@SuppressWarnings("deprecation")
OpenApiDocument toOpenApiDocument(SmallRyeOpenAPI finalOpenAPI) {
OpenApiDocument output = OpenApiDocument.newInstance();
output.set(finalOpenAPI.model());
openApiDocumentProducer.produce(new OpenApiDocumentBuildItem(output));
return output;
}

@BuildStep
Expand Down Expand Up @@ -1099,16 +1107,24 @@ private Stream<? extends InputStream> loadResources(String path, List<Pattern> i
}

private InputStream loadResource(String path, URL url) {
try (InputStream inputStream = url.openStream()) {
if (inputStream != null) {
byte[] contents = IoUtil.readBytes(inputStream);
return new ByteArrayInputStream(contents);
}
Supplier<String> msg = () -> "An error occurred while processing %s for %s".formatted(url, path);

try {
return ClassPathUtils.readStream(url, inputStream -> {
if (inputStream != null) {
try {
byte[] contents = IoUtil.readBytes(inputStream);
return new ByteArrayInputStream(contents);
} catch (IOException ioe) {
throw new UncheckedIOException(msg.get(), ioe);
}
}

return null;
});
} catch (IOException e) {
throw new UncheckedIOException("An error occurred while processing %s for %s".formatted(url, path), e);
throw new UncheckedIOException(msg.get(), e);
}

return null;
}

private boolean shouldIgnore(List<Pattern> ignorePatterns, String url) {
Expand Down Expand Up @@ -1136,6 +1152,7 @@ private List<String> getResourceFiles(Path resourcePath, Path target) {
}
} else {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
// QuarkusClassLoader will return a ByteArrayInputStream of directory entry names
try (InputStream inputStream = cl.getResourceAsStream(resourceName)) {
if (inputStream != null) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
Expand Down
Loading