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

Update to Smallrye OpenAPI 3.1.1 and add Jandex 3 #23686

Merged
merged 8 commits into from
Jan 23, 2023
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
30 changes: 20 additions & 10 deletions dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,11 @@
<artifactId>smallrye-config</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-api</artifactId>
Expand Down Expand Up @@ -826,6 +831,16 @@
<artifactId>smallrye-metrics</artifactId>
<version>5.0.0-M5</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-core</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-jaxrs</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter</artifactId>
Expand Down Expand Up @@ -2481,6 +2496,11 @@
<artifactId>microprofile-openapi-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.opentracing</groupId>
<artifactId>microprofile-opentracing-api</artifactId>
Expand Down Expand Up @@ -4141,21 +4161,11 @@
<artifactId>smallrye-open-api-core</artifactId>
<version>2.1.15</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-core</artifactId>
<version>3.1.0-RC1</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-jaxrs</artifactId>
<version>2.1.15</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-jaxrs</artifactId>
<version>3.1.0-RC1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions dev/cnf/oss_dependencies.maven
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ io.smallrye.common:smallrye-common-function:1.6.0
io.smallrye.config:smallrye-config-common:2.5.1
io.smallrye.config:smallrye-config-core:2.5.1
io.smallrye.config:smallrye-config:2.5.1
io.smallrye:jandex:3.0.5
io.smallrye:smallrye-graphql-api:1.0.26
io.smallrye:smallrye-graphql-cdi:1.0.26
io.smallrye:smallrye-graphql-client-api:1.0.26
Expand All @@ -161,6 +162,8 @@ io.smallrye:smallrye-graphql-schema-model:1.0.26
io.smallrye:smallrye-graphql-servlet:1.0.26
io.smallrye:smallrye-graphql:1.0.26
io.smallrye:smallrye-metrics:5.0.0-M5
io.smallrye:smallrye-open-api-core:3.1.1
io.smallrye:smallrye-open-api-jaxrs:3.1.1
io.zipkin.reporter2:zipkin-reporter:2.16.3
io.zipkin.reporter2:zipkin-sender-okhttp3:2.16.3
io.zipkin.zipkin2:zipkin:2.23.2
Expand Down Expand Up @@ -492,6 +495,7 @@ org.eclipse.microprofile.openapi:microprofile-openapi-api:1.0.1
org.eclipse.microprofile.openapi:microprofile-openapi-api:1.1.1
org.eclipse.microprofile.openapi:microprofile-openapi-api:2.0
org.eclipse.microprofile.openapi:microprofile-openapi-api:3.0
org.eclipse.microprofile.openapi:microprofile-openapi-api:3.1
org.eclipse.microprofile.opentracing:microprofile-opentracing-api:1.0.1
org.eclipse.microprofile.opentracing:microprofile-opentracing-api:1.1
org.eclipse.microprofile.opentracing:microprofile-opentracing-api:1.2
Expand Down
1 change: 0 additions & 1 deletion dev/cnf/oss_ibm.maven
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ org.apache.aries.blueprint:org.apache.aries.blueprint:1.3.0-ibm-s20170710-0926
org.apache.geronimo.specs:geronimo-ejb_3.1_spec-alt:1.0.0
org.eclipse.microprofile.graphql:microprofile-graphql-api:1.0.0-20191203
org.eclipse.microprofile.graphql:microprofile-graphql-tck:1.0.0-20191203
org.eclipse.microprofile.openapi:microprofile-openapi-api:3.1
org.eclipse.microprofile.rest.client:microprofile-rest-client-tck:1.2.2-20210215
org.eclipse.microprofile.rest.client:microprofile-rest-client-tck:1.3.5-20210215
org.eclipse.microprofile.rest.client:microprofile-rest-client-tck:1.4.2-20210215
Expand Down
2 changes: 0 additions & 2 deletions dev/cnf/oss_source_dependencies.maven
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ io.smallrye:smallrye-graphql-schema-builder:1.0.9
io.smallrye:smallrye-graphql-servlet:1.0.9
io.smallrye:smallrye-graphql:1.0.9
io.smallrye:smallrye-open-api-core:2.1.15
io.smallrye:smallrye-open-api-core:3.1.0-RC1
io.smallrye:smallrye-open-api-jaxrs:2.1.15
io.smallrye:smallrye-open-api-jaxrs:3.1.0-RC1
javax.activation:activation:1.1
javax.annotation:javax.annotation-api:1.2
javax.annotation:javax.annotation-api:1.3.1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-include= ~${workspace}/cnf/resources/bnd/feature.props
symbolicName=io.openliberty.jandex.internal-3.0
singleton=true
-bundles=io.openliberty.io.smallrye.jandex3
kind=beta
edition=core
WLP-Activation-Type: parallel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ IBM-API-Package: \
io.openliberty.webBundle.internal-1.0,\
io.openliberty.restfulWS-3.1, \
io.openliberty.mpCompatible-6.0, \
io.openliberty.org.eclipse.microprofile.openapi-3.1
io.openliberty.org.eclipse.microprofile.openapi-3.1,\
io.openliberty.jandex.internal-3.0
-bundles=\
io.openliberty.io.smallrye.openapi3.core, \
io.openliberty.io.smallrye.openapi3.jaxrs, \
Expand Down
6 changes: 6 additions & 0 deletions dev/io.openliberty.io.smallrye.jandex3/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions dev/io.openliberty.io.smallrye.jandex3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/generated/
23 changes: 23 additions & 0 deletions dev/io.openliberty.io.smallrye.jandex3/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>io.openliberty.io.smallrye.jandex3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>bndtools.core.bndbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>bndtools.core.bndnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compileErrorAction=build
eclipse.preferences.version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Ant properties
#Automatically generated by the ant prepare.settings.files task
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
21 changes: 21 additions & 0 deletions dev/io.openliberty.io.smallrye.jandex3/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#*******************************************************************************
# Copyright (c) 2017, 2023 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# IBM Corporation - initial API and implementation
#*******************************************************************************

-include=\
jar:${fileuri;${repo;io.smallrye:jandex;3.0.5;EXACT}}!/META-INF/MANIFEST.MF,\
bnd.overrides

instrument.disabled: true

-buildpath:\
io.smallrye:jandex;version=3.0.5;strategy=exact
8 changes: 8 additions & 0 deletions dev/io.openliberty.io.smallrye.jandex3/bnd.overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-include= ~../cnf/resources/bnd/rejar.props
bVersion=1.0

Bundle-Name: jandex 3
Bundle-SymbolicName: io.openliberty.io.smallrye.jandex3

Include-Resource:\
@${repo;io.smallrye:jandex;3.0.5;EXACT}!/!META-INF/*
12 changes: 7 additions & 5 deletions dev/io.openliberty.io.smallrye.openapi.core/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#*******************************************************************************
# Copyright (c) 2020, 2022 IBM Corporation and others.
# Copyright (c) 2020, 2023 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# IBM Corporation - initial API and implementation
#*******************************************************************************
-include= ~../cnf/resources/bnd/rejar.props

Expand All @@ -24,6 +21,7 @@ src: src

Import-Package: \
io.smallrye.openapi.jaxrs,\
org.eclipse.microprofile.config;version="[2.0,4.0)",\
*

Export-Package: \
Expand All @@ -35,4 +33,8 @@ Export-Package: \
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
com.ibm.ws.logging;version=latest,\
com.ibm.websphere.javaee.validation.2.0;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest
com.ibm.websphere.org.osgi.service.component;version=latest,\
com.ibm.ws.org.jboss.jandex;version=latest,\
com.ibm.ws.org.jboss.logging;version=latest,\
io.openliberty.com.fasterxml.jackson;version=latest,\
io.openliberty.org.eclipse.microprofile.config.2.0;version=latest
11 changes: 6 additions & 5 deletions dev/io.openliberty.io.smallrye.openapi.jaxrs/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#*******************************************************************************
# Copyright (c) 2020, 2022 IBM Corporation and others.
# Copyright (c) 2020, 2023 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# IBM Corporation - initial API and implementation
#*******************************************************************************
-include= ~../cnf/resources/bnd/rejar.props

Expand Down Expand Up @@ -41,7 +38,11 @@ Export-Package: \
-buildpath: \
io.smallrye:smallrye-open-api-jaxrs;version=2.1,\
io.openliberty.org.eclipse.microprofile.openapi.2.0;version=latest,\
io.openliberty.io.smallrye.openapi.core;version=latest,\
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
com.ibm.ws.logging;version=latest,\
com.ibm.ws.classloading;version=latest,\
com.ibm.websphere.javaee.validation.2.0;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest
com.ibm.websphere.org.osgi.service.component;version=latest,\
com.ibm.ws.org.jboss.jandex;version=latest,\
com.ibm.ws.org.jboss.logging;version=latest
1 change: 1 addition & 0 deletions dev/io.openliberty.io.smallrye.openapi3.core/.classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
Expand Down
2 changes: 1 addition & 1 deletion dev/io.openliberty.io.smallrye.openapi3.core/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Export-Package: \
io.openliberty.jakarta.validation.3.0;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest,\
io.openliberty.com.fasterxml.jackson;version=latest,\
com.ibm.ws.org.jboss.jandex;version=latest,\
io.openliberty.io.smallrye.jandex3;version=latest,\
com.ibm.ws.org.jboss.logging;version=latest,\
io.openliberty.org.eclipse.microprofile.config.3.0;version=latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright 2022 Red Hat, Inc, and individual contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* Liberty changes are enclosed by LIBERTY CHANGE START and LIBERTY CHANGE END
*/
package io.smallrye.openapi.api.util;

import io.smallrye.openapi.runtime.util.ModelUtil;

public final class VersionUtil {

private VersionUtil() {
}

// LIBERTY CHANGE START
// Hard code the version of the MP spec that is being used rather than trying to read it from the maven metadata in the API jar
static final String MP_VERSION = "3.1";
// LIBERTY CHANGE END

static final String[] MP_VERSION_COMPONENTS = ModelUtil.supply(() -> {
int suffix = MP_VERSION.indexOf('-');
return (suffix > -1 ? MP_VERSION.substring(0, suffix) : MP_VERSION).split("\\.");
});

public static int compareMicroProfileVersion(String checkVersion) {
String[] checkComponents = checkVersion.split("\\.");
int max = Math.max(MP_VERSION_COMPONENTS.length, checkComponents.length);
int result = 0;

for (int i = 0; i < max; i++) {
int mp = component(MP_VERSION_COMPONENTS, i);
int cv = component(checkComponents, i);

if ((result = Integer.compare(mp, cv)) != 0) {
break;
}
}

return result;
}

static int component(String[] components, int offset) {
return offset < components.length ? Integer.parseInt(components[offset]) : 0;
}
}
2 changes: 1 addition & 1 deletion dev/io.openliberty.io.smallrye.openapi3.jaxrs/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Export-Package: \
io.smallrye:smallrye-open-api-jaxrs;version=3.1,\
io.openliberty.org.eclipse.microprofile.openapi.3.1;version=latest,\
com.ibm.ws.org.jboss.logging;version=latest,\
com.ibm.ws.org.jboss.jandex;version=latest,\
io.openliberty.io.smallrye.jandex3;version=latest,\
io.openliberty.io.smallrye.openapi3.core;version=latest,\
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
com.ibm.ws.logging;version=latest,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,14 @@ public Collection<ConfigField> getConfigFields() {
return Arrays.asList(ConfigField20.values());
}

@Override
public String getPathServers(OpenApiConfig config, String path) {
return ConfigField.serializeSet(config.pathServers(path));
}

@Override
public String getOperationServers(OpenApiConfig config, String operationId) {
return ConfigField.serializeSet(config.operationServers(operationId));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Import-Package: \
io.openliberty.microprofile.openapi.internal.resources.validation,\
javax.xml.bind.annotation;version=!,\
io.smallrye.openapi.*;version="[2.0,4.0)",\
org.jboss.jandex;version="[2.4,4)",\
*

Export-Package: \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public Properties serializeConfig(OpenApiConfig config, OpenAPI model) {
}
}
for (String pathName : getPathNames(model)) {
Set<String> value = config.pathServers(pathName);
String value = configFieldProvider.getPathServers(config, pathName);
if (value != null && !value.isEmpty()) {
result.put("pathServer." + pathName, ConfigField.serializeSet(value));
result.put("pathServer." + pathName, value);
}
}
for (String operationId : getOperationIds(model)) {
Set<String> value = config.operationServers(operationId);
String value = configFieldProvider.getOperationServers(config, operationId);
if (value != null && !value.isEmpty()) {
result.put("operationServer." + operationId, ConfigField.serializeSet(value));
result.put("operationServer." + operationId, value);
}
}
return result;
Expand Down
Loading