diff --git a/api/pom.xml b/api/pom.xml
index 466875d4f..3edf9fab7 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -20,7 +20,7 @@
org.eclipse.microprofile.openapi
microprofile-openapi-parent
- 3.2-SNAPSHOT
+ 4.0-SNAPSHOT
microprofile-openapi-api
@@ -33,21 +33,11 @@
osgi.annotation
provided
+
+ org.eclipse.microprofile.openapi
+ microprofile-openapi-spi
+ ${project.version}
+ provided
+
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.2.1
-
-
- **/module-info.java
-
-
-
-
-
diff --git a/api/src/main/java/module-info.java b/api/src/main/java/module-info.java
index e107c72ca..67479a1a7 100644
--- a/api/src/main/java/module-info.java
+++ b/api/src/main/java/module-info.java
@@ -17,6 +17,7 @@
* A set of Java interfaces, annotations, and programming models which allow Java developers to natively produce OpenAPI
* documents from Jakarta RESTful Web Services applications.
*/
+@SuppressWarnings("module") // silence warning about unstable name `osgi.annotation`
module org.eclipse.microprofile.openapi {
exports org.eclipse.microprofile.openapi;
@@ -45,7 +46,8 @@
exports org.eclipse.microprofile.openapi.models.security;
exports org.eclipse.microprofile.openapi.models.servers;
exports org.eclipse.microprofile.openapi.models.tags;
- exports org.eclipse.microprofile.openapi.spi;
+
+ requires org.eclipse.microprofile.openapi.spi;
// Required for compilation, not used at runtime
requires static osgi.annotation;
diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java b/api/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
deleted file mode 100644
index a0b72b608..000000000
--- a/api/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2017 Contributors to the Eclipse Foundation
- *
- * 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.
- */
-
-package org.eclipse.microprofile.openapi.spi;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ServiceLoader;
-
-import org.eclipse.microprofile.openapi.models.Constructible;
-
-/**
- * This class is not intended to be used by end-users. It should be used by vendors to set their implementation of
- * OASFactoryResolver.
- *
- *
- *
- * Service provider for OASFactoryResolver. The implementation registers itself via the {@link java.util.ServiceLoader}
- * mechanism or by manually setting their implementation using the setInstance method.
- *
- */
-public abstract class OASFactoryResolver {
-
- private static volatile OASFactoryResolver instance = null;
-
- /**
- * Create a new instance of a constructible element from the OpenAPI model tree.
- *
- * @param
- * describes the type parameter
- * @param clazz
- * represents a model which extends the org.eclipse.microprofile.openapi.models.Constructible interface
- *
- * @return a new instance of the requested model class
- *
- * @throws NullPointerException
- * if the specified class is null
- * @throws IllegalArgumentException
- * if an instance could not be created, most likely, due to an illegal or inappropriate class
- */
- public abstract T createObject(Class clazz);
-
- /**
- * Creates an OASFactoryResolver object. Only used internally from within
- * {@link org.eclipse.microprofile.openapi.OASFactory}
- *
- * @return an instance of OASFactoryResolver
- */
- public static OASFactoryResolver instance() {
- if (instance == null) {
- synchronized (OASFactoryResolver.class) {
- if (instance != null) {
- return instance;
- }
-
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction() {
- @Override
- public ClassLoader run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- if (cl == null) {
- cl = OASFactoryResolver.class.getClassLoader();
- }
-
- OASFactoryResolver newInstance = loadSpi(cl);
-
- if (newInstance == null) {
- throw new IllegalStateException("No OASFactoryResolver implementation found!");
- }
-
- instance = newInstance;
- }
- }
-
- return instance;
- }
-
- private static OASFactoryResolver loadSpi(ClassLoader cl) {
- if (cl == null) {
- return null;
- }
-
- OASFactoryResolver instance = null;
-
- ServiceLoader sl = ServiceLoader.load(OASFactoryResolver.class, cl);
- for (OASFactoryResolver spi : sl) {
- if (instance != null) {
- throw new IllegalStateException(
- "Multiple OASFactoryResolver implementations found: " + spi.getClass().getName() + " and "
- + instance.getClass().getName());
- } else {
- instance = spi;
- }
- }
- return instance;
- }
-
- /**
- * Set the instance. It is used by OSGi environment while service loader pattern is not supported.
- *
- * @param factory
- * set the instance.
- */
- public static void setInstance(OASFactoryResolver factory) {
- instance = factory;
- }
-}
diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
deleted file mode 100644
index 0512e05cd..000000000
--- a/api/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2017 Contributors to the Eclipse Foundation
- *
- * 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.
- */
-
-/**
- * Service provider interface which allows vendors to set their implementations of OASFactoryResolver.
- */
-
-@org.osgi.annotation.versioning.Version("1.0")
-@org.osgi.annotation.versioning.ProviderType
-package org.eclipse.microprofile.openapi.spi;
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 988797088..fde0114f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
org.eclipse.microprofile.openapi
microprofile-openapi-parent
- 3.2-SNAPSHOT
+ 4.0-SNAPSHOT
pom
MicroProfile OpenAPI
Eclipse MicroProfile OpenAPI
@@ -80,6 +80,7 @@
+
api
tck
@@ -87,4 +88,19 @@
spi
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.2.1
+
+
+ **/module-info.java
+
+
+
+
+
diff --git a/spec/pom.xml b/spec/pom.xml
index 05d679445..336955778 100644
--- a/spec/pom.xml
+++ b/spec/pom.xml
@@ -20,7 +20,7 @@
org.eclipse.microprofile.openapi
microprofile-openapi-parent
- 3.2-SNAPSHOT
+ 4.0-SNAPSHOT
microprofile-openapi-spec
diff --git a/spi/pom.xml b/spi/pom.xml
index 8ab4eeaad..0112f2c0c 100644
--- a/spi/pom.xml
+++ b/spi/pom.xml
@@ -20,27 +20,17 @@
org.eclipse.microprofile.openapi
microprofile-openapi-parent
- 3.2-SNAPSHOT
+ 4.0-SNAPSHOT
microprofile-openapi-spi
MicroProfile OpenAPI SPI
-
- MicroProfile OpenAPI :: SPI
-
- This module is deprecated and will be removed in a future release of MicroProfile
- OpenAPI. The functionality offered by this module is available in the microprofile-openapi-api
- module which should be used instead.
-
+ MicroProfile OpenAPI :: SPI
org.osgi
osgi.annotation
-
- org.eclipse.microprofile.openapi
- microprofile-openapi-api
-
diff --git a/spi/src/main/java/module-info.java b/spi/src/main/java/module-info.java
new file mode 100644
index 000000000..6fe2d137b
--- /dev/null
+++ b/spi/src/main/java/module-info.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * 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.
+ */
+
+/**
+ * Eclipse MicroProfile OpenAPI SPI
+ *
+ * This module is not intended to be used by end-users. It should be used by vendors to set their implementation of
+ * OASFactoryResolver.
+ */
+@SuppressWarnings("module") // silence warning about unstable name `osgi.annotation`
+module org.eclipse.microprofile.openapi.spi {
+
+ exports org.eclipse.microprofile.openapi.spi;
+
+ uses org.eclipse.microprofile.openapi.spi.OASFactoryResolver;
+
+ // Required for compilation, not used at runtime
+ requires static osgi.annotation;
+
+}
diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
index c67414f3d..531d67dd2 100644
--- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
+++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
@@ -20,22 +20,15 @@
import java.security.PrivilegedAction;
import java.util.ServiceLoader;
-import org.eclipse.microprofile.openapi.models.Constructible;
-
/**
* This class is not intended to be used by end-users. It should be used by vendors to set their implementation of
* OASFactoryResolver.
*
- *
- *
+ *
* Service provider for OASFactoryResolver. The implementation registers itself via the {@link java.util.ServiceLoader}
* mechanism or by manually setting their implementation using the setInstance method.
*
- * @deprecated the OASFactoryResolver available in module
- * {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version
- * which will be removed in a future major release.
*/
-@Deprecated(forRemoval = true)
public abstract class OASFactoryResolver {
private static volatile OASFactoryResolver instance = null;
@@ -55,7 +48,7 @@ public abstract class OASFactoryResolver {
* @throws IllegalArgumentException
* if an instance could not be created, most likely, due to an illegal or inappropriate class
*/
- public abstract T createObject(Class clazz);
+ public abstract T createObject(Class clazz);
/**
* Creates an OASFactoryResolver object. Only used internally from within
@@ -98,18 +91,16 @@ private static OASFactoryResolver loadSpi(ClassLoader cl) {
return null;
}
- OASFactoryResolver instance = loadSpi(cl.getParent());
+ OASFactoryResolver instance = null;
- if (instance == null) {
- ServiceLoader sl = ServiceLoader.load(OASFactoryResolver.class, cl);
- for (OASFactoryResolver spi : sl) {
- if (instance != null) {
- throw new IllegalStateException(
- "Multiple OASFactoryResolver implementations found: " + spi.getClass().getName() + " and "
- + instance.getClass().getName());
- } else {
- instance = spi;
- }
+ ServiceLoader sl = ServiceLoader.load(OASFactoryResolver.class, cl);
+ for (OASFactoryResolver spi : sl) {
+ if (instance != null) {
+ throw new IllegalStateException(
+ "Multiple OASFactoryResolver implementations found: " + spi.getClass().getName() + " and "
+ + instance.getClass().getName());
+ } else {
+ instance = spi;
}
}
return instance;
diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
index 2560ea61e..d6129f3d6 100644
--- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
+++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
@@ -13,11 +13,7 @@
/**
* Service provider interface which allows vendors to set their implementations of OASFactoryResolver.
- *
- * The {@code org.eclipse.microprofile.openapi.spi} package available in module
- * {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version which will
- * be removed in a future major release.
*/
-@Deprecated(forRemoval = true)
-@org.osgi.annotation.versioning.Version("1.0")
+@org.osgi.annotation.versioning.Version("2.0")
+@org.osgi.annotation.versioning.ProviderType
package org.eclipse.microprofile.openapi.spi;
diff --git a/tck/pom.xml b/tck/pom.xml
index 85370aba4..f2e5dfbe0 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -20,7 +20,7 @@
org.eclipse.microprofile.openapi
microprofile-openapi-parent
- 3.2-SNAPSHOT
+ 4.0-SNAPSHOT
microprofile-openapi-tck