Repository navigation
Conversation
Preserve module names, declare reflective access and service contracts, and verify packaged modules through an opt-in integration test on Java 17, 21 and 25. Refs: swagger-api#4991 swagger-api#4991
There was a problem hiding this comment.
🟡 Changes recommended
The REST descriptor blocks reflective context injection needed to initialize the built-in OpenAPI endpoints on the module path.
1 open issue
What changed in this PR
Adds native Java module descriptors to the six Swagger Core 3 runtime libraries, enabling explicit module-path use and jlink integration while preserving classpath support.
Changes:
- Defines module exports, dependencies, reflective access, and service contracts.
- Adds an opt-in packaged-module smoke test and runs it in both Maven workflows.
- Documents module configuration and verification while keeping existing tests on the classpath.
| File | Description |
|---|---|
| README.md | Links to Java module documentation. |
| pom.xml | Adds the jpms-it profile and preserves classpath testing. |
| modules/swagger-rest/src/main/java/module-info.java | Defines REST exports, dependencies, and extension consumption. |
| modules/swagger-rest-servlet-initializer/src/main/java/module-info.java | Registers the servlet initializer provider. |
| modules/swagger-models/src/main/java/module-info.java | Exports model packages and opens them to Jackson. |
| modules/swagger-jpms-integration-test/src/main/java/module-info.java | Defines the test consumer and service providers. |
| modules/swagger-jpms-integration-test/src/main/java/io/swagger/v3/jpms/test/ModulePathSmoke.java | Checks descriptors, services, scanning, and serialization. |
| modules/swagger-jpms-integration-test/pom.xml | Launches the packaged consumer without publishing it. |
| modules/swagger-integration/src/main/java/module-info.java | Defines integration exports and configuration service consumption. |
| modules/swagger-core/src/main/java/module-info.java | Defines core dependencies, exports, and converter consumption. |
| modules/swagger-annotations/src/main/java/module-info.java | Exports annotation packages. |
| JPMS.md | Documents module usage, reflection, services, and verification. |
| .github/workflows/maven.yml | Runs the module-path integration test. |
| .github/workflows/maven-pulls.yml | Runs the module-path integration test for pull requests. |
Review effort: Balanced
| exports io.swagger.v3.rest.ext; | ||
| exports io.swagger.v3.rest.integration; | ||
| exports io.swagger.v3.rest.integration.api; | ||
| exports io.swagger.v3.rest.integration.resources; |
Author
There was a problem hiding this comment.
@copilot Illegal reflection post JDK 8 is disabled intentionally - please review accordingly
Author
|
As the core - there are frameworks that still perform field injection post jdk 8 (Why g*d WHY!!!) - will keep the strict shade on the library for guicedee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Adds native
module-info.javadescriptors to the six Swagger Core 3 runtime libraries, using their existingAutomatic-Module-Namevalues. A named-module application can now resolve and link the official artifacts directly withjlink, without adding downstream wrapper descriptors.Related to #4991. This follows the Jackson 3 discussion and our migration from the community fork to the official 3.0.0 artifacts; it targets the
3.0.0branch.The descriptors export the existing packages, expose dependencies used by public APIs transitively, open model/configuration packages to Jackson, and declare the three Swagger service consumers plus the servlet initializer provider. The Servlet API remains optional for Reader-only usage via
requires static transitiveinswagger-rest.An opt-in
jpms-itprofile launches a named-module consumer against packaged JARs. It verifies all six explicit descriptors, four service contracts, REST class/package scanning, and JSON/YAML round trips for OpenAPI 3.0 and 3.1 with typed-map references. Existing unit and servlet integration tests keep their classpath environment. Both Maven workflows run the new consumer on their Java 17/21/25 matrix.Type of Change
Checklist
Validation
verify -Pjpms-itpassed, including Javadocs, servlet integration tests and Maven-plugin tests. Test reports contain 1,893 tests with zero failures, errors or skips.jlinkimage built successfully and ran the same consumer, including ClassGraph package scanning.Readersuccessfully withjakarta.servletabsent from the resolved module graph.See JPMS.md for module names, application descriptors, service providers and verification commands. The integration-test artifact is excluded from install/deploy. Hosted CI remains to run; the Gradle-plugin build was not run locally.