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 from 3.10.0 to 3.12.0, use new builder API #41037

Merged
merged 1 commit into from
Sep 12, 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 @@ -55,7 +55,7 @@
<smallrye-config.version>3.9.1</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>3.10.0</smallrye-open-api.version>
<smallrye-open-api.version>3.12.0</smallrye-open-api.version>
<smallrye-graphql.version>2.10.0</smallrye-graphql.version>
<smallrye-fault-tolerance.version>6.4.0</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 @@ -15,13 +15,10 @@
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;

import io.smallrye.openapi.runtime.scanner.AnnotationScannerExtension;
import io.smallrye.openapi.runtime.scanner.spi.AnnotationScanner;

/**
* This adds support for the quarkus.http.root-path config option
*/
public class CustomPathExtension implements AnnotationScannerExtension {
public class CustomPathExtension {

static final Set<DotName> APPLICATION_PATH = new TreeSet<>(Arrays.asList(
DotName.createSimple("jakarta.ws.rs.ApplicationPath"),
Expand All @@ -35,8 +32,7 @@ public CustomPathExtension(String rootPath, String appPath) {
this.appPath = appPath;
}

@Override
public void processScannerApplications(AnnotationScanner scanner, Collection<ClassInfo> applications) {
public String resolveContextRoot(Collection<ClassInfo> applications) {
Optional<String> appPathAnnotationValue = applications.stream()
.flatMap(app -> APPLICATION_PATH.stream().map(app::declaredAnnotation))
.filter(Objects::nonNull)
Expand All @@ -48,15 +44,13 @@ public void processScannerApplications(AnnotationScanner scanner, Collection<Cla
* If the @ApplicationPath was found, ignore the appPath given in configuration and only
* use the rootPath for the contextRoot.
*/
String contextRoot = appPathAnnotationValue.map(path -> buildContextRpot(rootPath))
.orElseGet(() -> buildContextRpot(rootPath, this.appPath));
String contextRoot = appPathAnnotationValue.map(path -> buildContextRoot(rootPath))
.orElseGet(() -> buildContextRoot(rootPath, this.appPath));

if (!"/".equals(contextRoot)) {
scanner.setContextRoot(contextRoot);
}
return "/".equals(contextRoot) ? null : contextRoot;
}

static String buildContextRpot(String... segments) {
static String buildContextRoot(String... segments) {
String path = Stream.of(segments)
.filter(Objects::nonNull)
.map(CustomPathExtension::stripSlashes)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.quarkus.smallrye.openapi.deployment;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.smallrye.openapi.api.SmallRyeOASConfig;

public class MediaTypeConfigSource implements ConfigSource {

private final Map<String, String> mediaTypes = new HashMap<>();

public MediaTypeConfigSource() {
mediaTypes.put(SmallRyeOASConfig.DEFAULT_PRODUCES_STREAMING, "application/octet-stream");
mediaTypes.put(SmallRyeOASConfig.DEFAULT_CONSUMES_STREAMING, "application/octet-stream");
mediaTypes.put(SmallRyeOASConfig.DEFAULT_PRODUCES, "application/json");
mediaTypes.put(SmallRyeOASConfig.DEFAULT_CONSUMES, "application/json");
mediaTypes.put(SmallRyeOASConfig.DEFAULT_PRODUCES_PRIMITIVES, "text/plain");
mediaTypes.put(SmallRyeOASConfig.DEFAULT_CONSUMES_PRIMITIVES, "text/plain");
}

@Override
public Set<String> getPropertyNames() {
return mediaTypes.keySet();
}

@Override
public String getValue(String propertyName) {
return mediaTypes.get(propertyName);
}

@Override
public String getName() {
return getClass().getSimpleName();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
import org.jboss.jandex.Type;

import io.quarkus.deployment.util.ServiceUtil;
import io.smallrye.openapi.runtime.scanner.AnnotationScannerExtension;

public class RESTEasyExtension implements AnnotationScannerExtension {
public class RESTEasyExtension {

private static final DotName DOTNAME_PROVIDER = DotName.createSimple("jakarta.ws.rs.ext.Provider");
private static final DotName DOTNAME_ASYNC_RESPONSE_PROVIDER = DotName
Expand Down Expand Up @@ -90,7 +89,6 @@ private void scanAsyncResponseProviders(IndexView index) {
}
}

@Override
public Type resolveAsyncType(Type type) {
if (type.kind() == Type.Kind.PARAMETERIZED_TYPE
&& asyncTypes.contains(type.name())) {
Expand Down
Loading
Loading