Fix Swagger annotation warnings in geode-dunit compilation #7948
+1
−0
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.
Overview
This PR resolves Swagger/OpenAPI annotation-related compilation warnings in the
geode-dunitmodule by adding the missingio.swagger.core.v3:swagger-annotationsdependency.Problem
When compiling the
geode-dunit:compileJavatask, the following warnings were generated:Root Cause
The
geode-dunitmodule references Swagger/OpenAPI annotations (such as@SchemawithAccessMode) through transitive dependencies fromgeode-coreandgeode-gfsh, both of which haveswagger-annotationsas implementation dependencies.However, the Swagger annotations API was not explicitly declared as a compile-time dependency for
geode-dunit. This caused the Java annotation processor to be unable to resolve theAccessModeenum during compilation, resulting in the warnings above.Dependency Chain
geode-dunit→geode-core→swagger-annotations(implementation)geode-dunit→geode-gfsh→swagger-annotations(implementation)The transitive nature of these dependencies meant that while the annotations were available at runtime, they weren't available to the annotation processor at compile time.
Solution
Added
io.swagger.core.v3:swagger-annotationsto thecompileOnlyconfiguration ingeode-dunit/build.gradle:compileOnly('io.swagger.core.v3:swagger-annotations')Why
compileOnlyscope?The
compileOnlyscope is the appropriate choice here because:geode-coreandgeode-gfshChanges
Modified Files
geode-dunit/build.gradle- Added Swagger annotations API dependency to compile classpathDiff Summary
dependencies { api(platform(project(':boms:geode-all-bom'))) + compileOnly('io.swagger.core.v3:swagger-annotations') implementation(project(':geode-logging')) implementation(project(':geode-serialization')) implementation(project(':geode-membership'))Testing
Verification Steps
./gradlew :geode-dunit:compileJavaTest Results
✅ No Swagger/OpenAPI annotation warnings
✅ Build successful
✅ All tasks completed without errors
✅ No runtime behavior changes
Related Modules
Other Geode modules follow similar patterns for Swagger annotations dependencies:
geode-coreimplementationgeode-gfshimplementationgeode-managementtestCompileOnlygeode-deployment-legacycompileOnlygeode-assemblydistributedTestCompileOnlygeode-server-allserverNonOptionalThis change brings
geode-dunitin line with the established pattern for handling Swagger annotations dependencies across the project, particularly matching the approach used ingeode-deployment-legacywhich also usescompileOnly.Impact
Build Impact
Performance
Compatibility
Benefits
Checklist
Additional Context
This fix is part of ensuring clean compilation across all Geode modules and maintaining consistency in dependency management. The Swagger annotations are used throughout the Geode codebase for REST API documentation, and this change ensures that the annotation processor has access to the necessary types during compilation.
Background on Swagger Annotations in Geode
Geode uses Swagger/OpenAPI annotations (from
io.swagger.core.v3:swagger-annotations) to document its REST APIs. These annotations include:@Schema- Describes model schemas@Schema.AccessMode- Specifies access mode (READ_ONLY, WRITE_ONLY, etc.)The annotations are processed at compile time by annotation processors, which require the annotation definitions to be available on the compile classpath, even if the code doesn't directly reference them.
Why This Wasn't Caught Earlier
The warnings only appear during compilation and don't cause build failures. They can be easily overlooked in large build outputs but should be addressed to maintain code quality and developer experience.
For all changes, please confirm:
develop)?gradlew buildrun cleanly?